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
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);