dovecot-2.2: lib-http: Fixed a hang

dovecot at dovecot.org dovecot at dovecot.org
Wed Mar 26 15:18:08 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/57638bf8ee3e
changeset: 17172:57638bf8ee3e
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Mar 26 16:17:34 2014 +0100
description:
lib-http: Fixed a hang
Patch by Stephan Bosch

diffstat:

 src/lib-http/http-client-queue.c |  15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)

diffs (29 lines):

diff -r 22424f1a32ad -r 57638bf8ee3e src/lib-http/http-client-queue.c
--- a/src/lib-http/http-client-queue.c	Wed Mar 26 14:41:05 2014 +0100
+++ b/src/lib-http/http-client-queue.c	Wed Mar 26 16:17:34 2014 +0100
@@ -228,11 +228,24 @@
 
 	if (!http_client_peer_is_connected(peer)) {
 		unsigned int msecs;
+		bool new_peer = TRUE;
 
 		/* not already connected, wait for connections */
 		if (!array_is_created(&queue->pending_peers))
 			i_array_init(&queue->pending_peers, 8);
-		array_append(&queue->pending_peers, &peer, 1);			
+		else {
+			struct http_client_peer *const *peer_idx;
+
+			/* we may be waiting for this peer already */
+			array_foreach(&queue->pending_peers, peer_idx) {
+				if (http_client_peer_addr_cmp(&(*peer_idx)->addr, addr) == 0) {
+					new_peer = FALSE;
+					break;
+				}
+			}
+		}
+		if (new_peer)
+			array_append(&queue->pending_peers, &peer, 1);
 
 		/* start soft connect time-out (but only if we have another IP left) */
 		msecs = host->client->set.soft_connect_timeout_msecs;


More information about the dovecot-cvs mailing list