dovecot-2.2: lib-http: If connect to peer failed, don't recreate...
dovecot at dovecot.org
dovecot at dovecot.org
Sun Jun 9 02:08:34 EEST 2013
details: http://hg.dovecot.org/dovecot-2.2/rev/ac78c4c88ba9
changeset: 16482:ac78c4c88ba9
user: Timo Sirainen <tss at iki.fi>
date: Sun Jun 09 02:08:24 2013 +0300
description:
lib-http: If connect to peer failed, don't recreate a new connection to handle pending requests.
The new connection would very likely fail as well. Another peer for the host
should pick up the requests.
diffstat:
src/lib-http/http-client-peer.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diffs (31 lines):
diff -r 7e91b0709f06 -r ac78c4c88ba9 src/lib-http/http-client-peer.c
--- a/src/lib-http/http-client-peer.c Sun Jun 09 00:48:14 2013 +0300
+++ b/src/lib-http/http-client-peer.c Sun Jun 09 02:08:24 2013 +0300
@@ -277,12 +277,12 @@
http_client_peer_debug(peer, "Failed to make connection");
+ peer->last_connect_failed = TRUE;
if (array_count(&peer->conns) > 1) {
/* 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
more than one connection until connects work again. */
- peer->last_connect_failed = TRUE;
} else {
/* this was the only/last connection and connecting to it
failed. a second connect will probably also fail, so just
@@ -306,8 +306,11 @@
http_client_peer_debug(peer, "Lost a connection (%d connections left)",
array_count(&peer->conns));
- /* if there are pending requests, create a new connection for them. */
- http_client_peer_handle_requests(peer);
+ if (!peer->last_connect_failed) {
+ /* if there are pending requests, create a new
+ connection for them. */
+ http_client_peer_handle_requests(peer);
+ }
if (array_count(&peer->conns) == 0 &&
http_client_peer_requests_pending(peer, &num_urgent) == 0)
http_client_peer_free(&peer);
More information about the dovecot-cvs
mailing list