dovecot-2.2: lib-http: Avoid hanging in http_client_wait() while...

dovecot at dovecot.org dovecot at dovecot.org
Wed Feb 20 11:59:14 EET 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/164c70254dd0
changeset: 15855:164c70254dd0
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Feb 20 11:57:55 2013 +0200
description:
lib-http: Avoid hanging in http_client_wait() while there's nothing to do.

diffstat:

 src/lib-http/http-client-request.c |  3 +++
 src/lib-http/http-client.c         |  3 +++
 2 files changed, 6 insertions(+), 0 deletions(-)

diffs (26 lines):

diff -r 3bc84d6c9e8d -r 164c70254dd0 src/lib-http/http-client-request.c
--- a/src/lib-http/http-client-request.c	Wed Feb 20 11:18:59 2013 +0200
+++ b/src/lib-http/http-client-request.c	Wed Feb 20 11:57:55 2013 +0200
@@ -87,6 +87,9 @@
 	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)
diff -r 3bc84d6c9e8d -r 164c70254dd0 src/lib-http/http-client.c
--- a/src/lib-http/http-client.c	Wed Feb 20 11:18:59 2013 +0200
+++ b/src/lib-http/http-client.c	Wed Feb 20 11:57:55 2013 +0200
@@ -165,6 +165,9 @@
 
 	i_assert(client->ioloop == NULL);
 
+	if (client->pending_requests == 0)
+		return;
+
 	client->ioloop = io_loop_create();
 	http_client_switch_ioloop(client);
 


More information about the dovecot-cvs mailing list