| 123 | } |
| 124 | |
| 125 | void HttpService::process() |
| 126 | { |
| 127 | MutexGuard<Mutex> guard(m_mutex); |
| 128 | |
| 129 | if (true == m_isRunning) |
| 130 | { |
| 131 | if (true == m_workerData.mutex.take(0U)) |
| 132 | { |
| 133 | /* Handle received HTTP responses. */ |
| 134 | if (INVALID_HTTP_JOB_ID != m_workerData.response.jobId) |
| 135 | { |
| 136 | m_responseList.emplace_back(m_workerData.response); |
| 137 | |
| 138 | /* Clear worker response. */ |
| 139 | m_workerData.response = WorkerResponse(); |
| 140 | |
| 141 | /* Clear active job id. */ |
| 142 | m_activeJobId = INVALID_HTTP_JOB_ID; |
| 143 | } |
| 144 | |
| 145 | /* Handle pending HTTP requests. */ |
| 146 | if (INVALID_HTTP_JOB_ID == m_activeJobId) |
| 147 | { |
| 148 | /* Check for new requests to process. */ |
| 149 | if (false == m_requestList.empty()) |
| 150 | { |
| 151 | m_workerData.request = m_requestList.front(); |
| 152 | m_activeJobId = m_workerData.request.jobId; |
| 153 | |
| 154 | /* Remove the request from the list. */ |
| 155 | (void)m_requestList.erase(m_requestList.begin()); |
| 156 | } |
| 157 | } |
| 158 | |
| 159 | (void)m_workerData.mutex.give(); |
| 160 | } |
| 161 | } |
| 162 | } |
| 163 | |
| 164 | HttpJobId HttpService::get(const char* url, IHttpResponseHandler* handler) |
| 165 | { |
nothing calls this directly
no test coverage detected