From: Stephan Bosch Date: Fri, 20 Jan 2017 00:10:04 +0000 (+0100) Subject: lib-http: client: Drop peer immediately if it has no more linked queues and it is... X-Git-Tag: 2.3.0.rc1~1376 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d4f77de194b5adfb2847459c0fe918234549ca7b;p=thirdparty%2Fdovecot%2Fcore.git 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. --- 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));