From: Stephan Bosch Date: Thu, 6 Sep 2018 01:23:26 +0000 (+0200) Subject: lib-http: client: connection: Unlist the connection as pending immediately in http_cl... X-Git-Tag: 2.3.4~214 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0c5dea54e5bd7ed0ed3a303ef08cd62f2c7b7c32;p=thirdparty%2Fdovecot%2Fcore.git lib-http: client: connection: Unlist the connection as pending immediately in http_client_connection_failure(). --- diff --git a/src/lib-http/http-client-connection.c b/src/lib-http/http-client-connection.c index c13430af4a..abb7bb9223 100644 --- a/src/lib-http/http-client-connection.c +++ b/src/lib-http/http-client-connection.c @@ -71,6 +71,7 @@ http_client_connection_failure(struct http_client_connection *conn, struct http_client_peer *peer = conn->peer; conn->connect_failed = TRUE; + http_client_connection_unlist_pending(conn); http_client_peer_connection_failure(peer, reason); } diff --git a/src/lib-http/http-client-peer.c b/src/lib-http/http-client-peer.c index 180a9006b1..afa71e94ec 100644 --- a/src/lib-http/http-client-peer.c +++ b/src/lib-http/http-client-peer.c @@ -246,20 +246,14 @@ static void http_client_peer_pool_connection_failure( struct http_client_peer_pool *ppool, const char *reason) { - unsigned int pending; - - /* count number of pending connections */ - pending = array_count(&ppool->pending_conns); - i_assert(pending > 0); - e_debug(ppool->event, "Failed to make connection " "(connections=%u, connecting=%u)", - array_count(&ppool->conns), pending); + array_count(&ppool->conns), array_count(&ppool->pending_conns)); http_client_peer_shared_connection_failure(ppool->peer); - if (pending > 1) { + if (array_count(&ppool->pending_conns) > 0) { /* if there are other connections attempting to connect, wait for them before failing the requests. remember that we had trouble with connecting so in future we don't try to create @@ -507,7 +501,7 @@ http_client_peer_shared_connection_failure( pshared->last_failure = ioloop_timeval; /* manage backoff timer only when this was the only attempt */ - if (pending == 1) + if (pending == 0) http_client_peer_shared_increase_backoff_timer(pshared); }