HttpResponse reference counting bug fixed

This commit is contained in:
byeonggee.seo 2015-02-02 12:23:15 +09:00
parent 173578cf41
commit 23e0320cac
4 changed files with 16 additions and 13 deletions

View File

@ -795,10 +795,8 @@ void HttpClient::networkThread()
}
// Worker thread
void HttpClient::networkThreadAlone(HttpRequest* request)
void HttpClient::networkThreadAlone(HttpRequest* request, HttpResponse* response)
{
// Create a HttpResponse object, the default setting is http access failed
HttpResponse *response = new (std::nothrow) HttpResponse(request);
std::string responseMessage = "";
processResponse(response, responseMessage);
@ -920,7 +918,10 @@ void HttpClient::sendImmediate(HttpRequest* request)
}
request->retain();
auto t = std::thread(&HttpClient::networkThreadAlone, this, request);
// Create a HttpResponse object, the default setting is http access failed
HttpResponse *response = new (std::nothrow) HttpResponse(request);
auto t = std::thread(&HttpClient::networkThreadAlone, this, request, response);
t.detach();
}

View File

@ -126,10 +126,8 @@ void HttpClient::networkThread()
}
// Worker thread
void HttpClient::networkThreadAlone(HttpRequest* request)
void HttpClient::networkThreadAlone(HttpRequest* request, HttpResponse* response)
{
// Create a HttpResponse object, the default setting is http access failed
HttpResponse *response = new (std::nothrow) HttpResponse(request);
char errorBuffer[ERROR_SIZE] = { 0 };
processResponse(response, errorBuffer);
@ -470,7 +468,10 @@ void HttpClient::sendImmediate(HttpRequest* request)
}
request->retain();
auto t = std::thread(&HttpClient::networkThreadAlone, this, request);
// Create a HttpResponse object, the default setting is http access failed
HttpResponse *response = new (std::nothrow) HttpResponse(request);
auto t = std::thread(&HttpClient::networkThreadAlone, this, request, response);
t.detach();
}

View File

@ -160,10 +160,8 @@ void HttpClient::networkThread()
}
// Worker thread
void HttpClient::networkThreadAlone(HttpRequest* request)
void HttpClient::networkThreadAlone(HttpRequest* request, HttpResponse* response)
{
// Create a HttpResponse object, the default setting is http access failed
HttpResponse *response = new (std::nothrow) HttpResponse(request);
char errorBuffer[CURL_ERROR_SIZE] = { 0 };
processResponse(response, errorBuffer);
@ -521,7 +519,10 @@ void HttpClient::sendImmediate(HttpRequest* request)
}
request->retain();
auto t = std::thread(&HttpClient::networkThreadAlone, this, request);
// Create a HttpResponse object, the default setting is http access failed
HttpResponse *response = new (std::nothrow) HttpResponse(request);
auto t = std::thread(&HttpClient::networkThreadAlone, this, request, response);
t.detach();
}

View File

@ -115,7 +115,7 @@ private:
*/
bool lazyInitThreadSemphore();
void networkThread();
void networkThreadAlone(HttpRequest* request);
void networkThreadAlone(HttpRequest* request, HttpResponse* response);
/** Poll function called from main thread to dispatch callbacks when http requests finished **/
void dispatchResponseCallbacks();