Skip to content

Commit 8c1d2b5

Browse files
bmehta001Copilot
andcommitted
Revert HttpClientManager, HttpResponseDecoder, fix TPM position
Revert HttpClientManager lock and HttpResponseDecoder leak fix to match main. Restore m_scheduledUploadTime before LOCKGUARD. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent a351865 commit 8c1d2b5

3 files changed

Lines changed: 5 additions & 13 deletions

File tree

lib/http/HttpClientManager.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -149,15 +149,8 @@ namespace MAT_NS_BEGIN {
149149
void HttpClientManager::cancelAllRequests()
150150
{
151151
cancelAllRequestsAsync();
152-
while (true)
153-
{
154-
{
155-
LOCKGUARD(m_httpCallbacksMtx);
156-
if (m_httpCallbacks.empty())
157-
break;
158-
}
152+
while (!m_httpCallbacks.empty())
159153
std::this_thread::yield();
160-
}
161154
}
162155

163156
// start async cancellation

lib/http/HttpResponseDecoder.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,13 @@ namespace MAT_NS_BEGIN {
6767
break;
6868

6969
case HttpResult_Aborted:
70+
ctx->httpResponse = nullptr;
7071
outcome = Abort;
7172
break;
7273

7374
case HttpResult_LocalFailure:
7475
case HttpResult_NetworkFailure:
76+
ctx->httpResponse = nullptr;
7577
outcome = RetryNetwork;
7678
break;
7779
}
@@ -127,7 +129,6 @@ namespace MAT_NS_BEGIN {
127129
evt.param1 = 0; // response.GetStatusCode();
128130
DispatchEvent(evt);
129131
}
130-
delete ctx->httpResponse;
131132
ctx->httpResponse = nullptr;
132133
// eventsRejected(ctx); // FIXME: [MG] - investigate why ctx gets corrupt after eventsRejected
133134
requestAborted(ctx);
@@ -158,8 +159,6 @@ namespace MAT_NS_BEGIN {
158159
evt.param1 = response.GetStatusCode();
159160
DispatchEvent(evt);
160161
}
161-
delete ctx->httpResponse;
162-
ctx->httpResponse = nullptr;
163162
temporaryNetworkFailure(ctx);
164163
break;
165164
}

lib/tpm/TransmissionPolicyManager.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ namespace MAT_NS_BEGIN {
154154
// m_isUploadScheduled check does not have to be strictly atomic because
155155
// the completion of upload will schedule more uploads as-needed, we only
156156
// want to avoid the unnecessary wasteful rescheduling.
157-
LOG_TRACE("WAIT upload %d ms for lat=%d", delta, m_runningLatency);
157+
LOG_TRACE("WAIT upload %d ms for lat=%d", delta, m_runningLatency.load());
158158
return;
159159
}
160160
}
@@ -173,7 +173,7 @@ namespace MAT_NS_BEGIN {
173173
{
174174
m_scheduledUploadTime = PAL::getMonotonicTimeMs() + delay.count();
175175
m_runningLatency = latency;
176-
LOG_TRACE("SCHED upload %d ms for lat=%d", delay.count(), m_runningLatency);
176+
LOG_TRACE("SCHED upload %d ms for lat=%d", delay.count(), m_runningLatency.load());
177177
m_scheduledUpload = PAL::scheduleTask(&m_taskDispatcher, static_cast<unsigned>(delay.count()), this, &TransmissionPolicyManager::uploadAsync, latency);
178178
}
179179
}

0 commit comments

Comments
 (0)