MCPcopy Create free account
hub / github.com/BlueAndi/Pixelix / getResponse

Method getResponse

lib/HttpService/src/HttpService.cpp:212–248  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

210}
211
212bool HttpService::getResponse(HttpJobId jobId, HttpRsp& response)
213{
214 bool isAvailable = false;
215 MutexGuard<Mutex> guard(m_mutex);
216
217 if (true == m_isRunning)
218 {
219 WorkerResponse workerRsp;
220
221 /* Search for the response with the given job id. */
222 for (WorkerResponseList::iterator it = m_responseList.begin(); it != m_responseList.end(); ++it)
223 {
224 if (jobId == it->jobId)
225 {
226 workerRsp = *it;
227
228 /* Remove the response from the list. */
229 (void)m_responseList.erase(it);
230 isAvailable = true;
231 break;
232 }
233 }
234
235 if (true == isAvailable)
236 {
237 response.statusCode = workerRsp.statusCode;
238
239 /* Move memory ownership from worker response to HTTP response. */
240 response.payload = workerRsp.payload;
241 response.size = workerRsp.size;
242 workerRsp.payload = nullptr;
243 workerRsp.size = 0U;
244 }
245 }
246
247 return isAvailable;
248}
249
250void HttpService::abortJob(HttpJobId jobId)
251{

Callers

nothing calls this directly

Calls 2

beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected