Mercurial > dovecot > core-2.2
changeset 16579:129ae6342b28
lib-http: Fixed tracking number of pending connections to host-port.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Wed, 10 Jul 2013 02:50:04 +0300 |
parents | 843208699cbc |
children | 4707096101a4 |
files | src/lib-http/http-client-host.c src/lib-http/http-client-peer.c src/lib-http/http-client-private.h |
diffstat | 3 files changed, 14 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-http/http-client-host.c Wed Jul 10 02:31:05 2013 +0300 +++ b/src/lib-http/http-client-host.c Wed Jul 10 02:50:04 2013 +0300 @@ -171,7 +171,8 @@ peer = http_client_peer_get(host->client, &addr); http_client_peer_add_host(peer, host); - hport->pending_connection_count++; + if (http_client_peer_handle_requests(peer)) + hport->pending_connection_count++; /* start soft connect time-out (but only if we have another IP left) */ msecs = host->client->set.soft_connect_timeout_msecs;
--- a/src/lib-http/http-client-peer.c Wed Jul 10 02:31:05 2013 +0300 +++ b/src/lib-http/http-client-peer.c Wed Jul 10 02:50:04 2013 +0300 @@ -93,7 +93,8 @@ } static bool -http_client_peer_next_request(struct http_client_peer *peer) +http_client_peer_next_request(struct http_client_peer *peer, + bool *created_connections) { struct http_client_connection *const *conn_idx; struct http_client_connection *conn = NULL; @@ -161,15 +162,21 @@ "(already %u usable, connecting to %u, closing %u)", new_connections, working_conn_count - connecting, connecting, closing); - http_client_peer_connect(peer, new_connections); + if (new_connections > 0) { + *created_connections = TRUE; + http_client_peer_connect(peer, new_connections); + } /* now we wait until it is connected */ return FALSE; } -void http_client_peer_handle_requests(struct http_client_peer *peer) +bool http_client_peer_handle_requests(struct http_client_peer *peer) { - while (http_client_peer_next_request(peer)) ; + bool created_connections = FALSE; + + while (http_client_peer_next_request(peer, &created_connections)) ; + return created_connections; } static struct http_client_peer * @@ -259,7 +266,6 @@ { if (!http_client_peer_have_host(peer, host)) array_append(&peer->hosts, &host, 1); - http_client_peer_handle_requests(peer); } struct http_client_request *
--- a/src/lib-http/http-client-private.h Wed Jul 10 02:31:05 2013 +0300 +++ b/src/lib-http/http-client-private.h Wed Jul 10 02:50:04 2013 +0300 @@ -246,7 +246,7 @@ struct http_client_request * http_client_peer_claim_request(struct http_client_peer *peer, bool no_urgent); -void http_client_peer_handle_requests(struct http_client_peer *peer); +bool http_client_peer_handle_requests(struct http_client_peer *peer); void http_client_peer_connection_success(struct http_client_peer *peer); void http_client_peer_connection_failure(struct http_client_peer *peer, const char *reason);