mirror of https://github.com/axmolengine/axmol.git
HttpResponse reference counting bug fixed
This commit is contained in:
parent
173578cf41
commit
23e0320cac
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
Loading…
Reference in New Issue