From d4f77de194b5adfb2847459c0fe918234549ca7b Mon Sep 17 00:00:00 2001 From: Stephan Bosch Date: Fri, 20 Jan 2017 01:10:04 +0100 Subject: [PATCH] lib-http: client: Drop peer immediately if it has no more linked queues and it is not connected and not waiting for a backoff timeout. It is currently unlikely to happen at this point, but it is better to make sure it is handled appropriately. The pending shared HTTP client changes will make this a likely event. This surfaced as a problem for the HTTP proxy. --- 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 7b1d63d030..306e4a8318 100644 --- a/src/lib-http/http-client-peer.c +++ b/src/lib-http/http-client-peer.c @@ -298,6 +298,11 @@ http_client_peer_handle_requests_real(struct http_client_peer *peer) /* disconnect pending connections if we're not linked to any queue anymore */ if (array_count(&peer->queues) == 0) { + if (array_count(&peer->conns) == 0 && peer->to_backoff == NULL) { + /* peer is completely unused and inactive; drop it immediately */ + http_client_peer_drop(&peer); + return; + } http_client_peer_debug(peer, "Peer no longer used; will now cancel pending connections " "(%u connections exist)", array_count(&peer->conns));