mirror of
https://github.com/typesense/typesense.git
synced 2025-05-20 05:32:30 +08:00
Fix curl client response wait cycle.
This commit is contained in:
parent
6062baafc8
commit
c299172ccc
@ -275,12 +275,14 @@ size_t HttpClient::curl_write_async(char *buffer, size_t size, size_t nmemb, voi
|
||||
|
||||
//LOG(INFO) << "curl_write_async response, res body size: " << req_res->res->body.size();
|
||||
|
||||
// wait for previous chunk to finish (if any)
|
||||
//LOG(INFO) << "Waiting on req_res " << req_res->res;
|
||||
req_res->res->wait();
|
||||
|
||||
async_req_res_t* async_req_res = new async_req_res_t(req_res->req, req_res->res, true);
|
||||
req_res->server->get_message_dispatcher()->send_message(HttpServer::STREAM_RESPONSE_MESSAGE, async_req_res);
|
||||
|
||||
// wait until response is sent
|
||||
//LOG(INFO) << "Waiting on req_res " << req_res->res;
|
||||
req_res->res->wait();
|
||||
//LOG(INFO) << "Response sent";
|
||||
|
||||
return res_size;
|
||||
@ -300,12 +302,13 @@ size_t HttpClient::curl_write_async_done(void *context, curl_socket_t item) {
|
||||
req_res->res->body = "";
|
||||
req_res->res->final = true;
|
||||
|
||||
// wait until final response is flushed or response object will be destroyed by caller
|
||||
//LOG(INFO) << "Waiting on req_res " << req_res->res;
|
||||
req_res->res->wait();
|
||||
|
||||
async_req_res_t* async_req_res = new async_req_res_t(req_res->req, req_res->res, true);
|
||||
req_res->server->get_message_dispatcher()->send_message(HttpServer::STREAM_RESPONSE_MESSAGE, async_req_res);
|
||||
|
||||
// wait until final response is flushed or response object will be destroyed by caller
|
||||
req_res->res->wait();
|
||||
|
||||
// Close the socket as we've overridden the close socket handler!
|
||||
close(item);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user