| 174 | } |
| 175 | |
| 176 | void GSDKInternal::heartbeatThreadFunc(std::string infoUrl) |
| 177 | { |
| 178 | resetCurl(); |
| 179 | curl_easy_setopt(m_curlHandle, CURLOPT_URL, infoUrl.c_str()); |
| 180 | |
| 181 | m_receivedData = ""; |
| 182 | curl_easy_setopt(m_curlHandle, CURLOPT_CUSTOMREQUEST, "POST"); |
| 183 | |
| 184 | Json::Value jsonInfoRequest; |
| 185 | jsonInfoRequest[GSDK_INFO_FLAVOR_KEY] = GSDK_INFO_FLAVOR; |
| 186 | jsonInfoRequest[GSDK_INFO_VERSION_KEY] = GSDK_INFO_VERSION; |
| 187 | |
| 188 | std::string infoRequest = jsonInfoRequest.toStyledString(); |
| 189 | curl_easy_setopt(m_curlHandle, CURLOPT_POSTFIELDS, infoRequest.c_str()); |
| 190 | curl_easy_perform(m_curlHandle); |
| 191 | |
| 192 | long http_code = 0; |
| 193 | curl_easy_getinfo(m_curlHandle, CURLINFO_RESPONSE_CODE, &http_code); |
| 194 | if (http_code >= 300) |
| 195 | { |
| 196 | GSDK::logMessage("Received non-success code from Agent when sending GSDK info. Status Code: " + std::to_string(http_code) + " Response Body: " + m_receivedData); |
| 197 | } |
| 198 | |
| 199 | while (m_keepHeartbeatRunning) |
| 200 | { |
| 201 | if (m_signalHeartbeatEvent.Wait(m_nextHeartbeatIntervalMs)) |
| 202 | { |
| 203 | if (m_debug) GSDK::logMessage("State transition signaled an early heartbeat."); |
| 204 | m_signalHeartbeatEvent.Reset(); // We've handled this signal, so reset the event |
| 205 | } |
| 206 | |
| 207 | sendHeartbeat(); |
| 208 | receiveHeartbeatResponse(); |
| 209 | } |
| 210 | } |
| 211 | |
| 212 | size_t GSDKInternal::curlReceiveData(char* buffer, size_t blockSize, size_t blockCount, void*) |
| 213 | { |
nothing calls this directly
no test coverage detected