Skip to content

Commit

Permalink
lib-http: client: Drop peer immediately if it has no more linked queu…
Browse files Browse the repository at this point in the history
…es 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.
  • Loading branch information
stephanbosch committed Jun 27, 2017
1 parent d7c917c commit d4f77de
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/lib-http/http-client-peer.c
Expand Up @@ -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));
Expand Down

0 comments on commit d4f77de

Please sign in to comment.