]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-http: Avoid hanging in http_client_wait() while there's nothing to do.
authorTimo Sirainen <tss@iki.fi>
Wed, 20 Feb 2013 09:57:55 +0000 (11:57 +0200)
committerTimo Sirainen <tss@iki.fi>
Wed, 20 Feb 2013 09:57:55 +0000 (11:57 +0200)
src/lib-http/http-client-request.c
src/lib-http/http-client.c

index fa9446bdd913ac64eb944d3b48f9b0f519a63de8..e9c3fc14453f5cf1cfd71458725cf8e8e8e68439 100644 (file)
@@ -87,6 +87,9 @@ void http_client_request_unref(struct http_client_request **_req)
        http_client_request_debug(req, "Destroy (requests left=%d)",
                client->pending_requests);
 
+       if (client->pending_requests == 0 && client->ioloop != NULL)
+               io_loop_stop(client->ioloop);
+
        if (req->payload_input != NULL)
                i_stream_unref(&req->payload_input);
        if (req->payload_output != NULL)
index 079adc25e915bd96014e97d267da45f5808bf388..c55191c4e257230d44877f9eaabff32e35ea0236 100644 (file)
@@ -165,6 +165,9 @@ void http_client_wait(struct http_client *client)
 
        i_assert(client->ioloop == NULL);
 
+       if (client->pending_requests == 0)
+               return;
+
        client->ioloop = io_loop_create();
        http_client_switch_ioloop(client);