mirror of
https://github.com/SChernykh/p2pool.git
synced 2024-11-16 15:57:39 +00:00
JSON RPC: fixed error checking
This commit is contained in:
parent
8f1fd55e2f
commit
37fba30c79
1 changed files with 14 additions and 10 deletions
|
@ -302,18 +302,22 @@ void CurlContext::check_multi_info()
|
||||||
int pending;
|
int pending;
|
||||||
while (CURLMsg* message = curl_multi_info_read(m_multiHandle, &pending)) {
|
while (CURLMsg* message = curl_multi_info_read(m_multiHandle, &pending)) {
|
||||||
if (message->msg == CURLMSG_DONE) {
|
if (message->msg == CURLMSG_DONE) {
|
||||||
if ((message->data.result != CURLE_OK) || m_response.empty()) {
|
if (message->data.result != CURLE_OK) {
|
||||||
m_error = m_response.empty() ? "empty response" : curl_easy_strerror(message->data.result);
|
m_error = curl_easy_strerror(message->data.result);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
long http_code = 0;
|
||||||
|
curl_easy_getinfo(message->easy_handle, CURLINFO_RESPONSE_CODE, &http_code);
|
||||||
|
|
||||||
long http_code = 0;
|
if (http_code != 200) {
|
||||||
curl_easy_getinfo(message->easy_handle, CURLINFO_RESPONSE_CODE, &http_code);
|
char buf[32] = {};
|
||||||
|
log::Stream s(buf);
|
||||||
if (http_code != 200) {
|
s << "HTTP error " << static_cast<int>(http_code) << '\0';
|
||||||
char buf[32] = {};
|
m_error = buf;
|
||||||
log::Stream s(buf);
|
}
|
||||||
s << "HTTP error " << static_cast<int>(http_code) << '\0';
|
else if (m_response.empty()) {
|
||||||
m_error = buf;
|
m_error = "empty response";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
curl_multi_remove_handle(m_multiHandle, m_handle);
|
curl_multi_remove_handle(m_multiHandle, m_handle);
|
||||||
|
|
Loading…
Reference in a new issue