From af7956fbd15f4ea875644df1a1cb5b97840d2d7b Mon Sep 17 00:00:00 2001 From: Stephan Bosch Date: Wed, 13 Dec 2017 21:52:41 +0100 Subject: [PATCH] lib-http: client: peer: Properly handle claiming an existing connection. If no other connections were being created, request handling was not restarted. This problem sometimes caused the client to hang. Fixed by calling http_client_peer_connection_success() upon claiming an existing connection. --- src/lib-http/http-client-peer.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/lib-http/http-client-peer.c b/src/lib-http/http-client-peer.c index 35252940e1..8d1bda4786 100644 --- a/src/lib-http/http-client-peer.c +++ b/src/lib-http/http-client-peer.c @@ -734,6 +734,7 @@ http_client_peer_do_connect(struct http_client_peer *peer, struct http_client_peer_pool *ppool = peer->ppool; struct http_client_connection *const *idle_conns; unsigned int i, idle_count; + bool claimed_existing = FALSE; if (count == 0) return; @@ -741,6 +742,7 @@ http_client_peer_do_connect(struct http_client_peer *peer, idle_conns = array_get(&ppool->idle_conns, &idle_count); for (i = 0; i < count && i < idle_count; i++) { http_client_connection_claim_idle(idle_conns[i], peer); + claimed_existing = TRUE; e_debug(peer->event, "Claimed idle connection (connections=%u)", @@ -752,6 +754,9 @@ http_client_peer_do_connect(struct http_client_peer *peer, "Making new connection %u of %u", i+1, count); (void)http_client_connection_create(peer); } + + if (claimed_existing) + http_client_peer_connection_success(peer); } static void