]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-http: client: Drop peer immediately if it has no more linked queues and it is...
authorStephan Bosch <stephan.bosch@dovecot.fi>
Fri, 20 Jan 2017 00:10:04 +0000 (01:10 +0100)
committerStephan Bosch <stephan.bosch@dovecot.fi>
Tue, 27 Jun 2017 11:52:42 +0000 (13:52 +0200)
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

index 7b1d63d03053f65153302fcb77c1ab4809347d67..306e4a83180f7434a219924db7301e2fc028a551 100644 (file)
@@ -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));