struct stat st;
conn->connected = TRUE;
+ conn->connect_succeeded = TRUE;
if (conn->to_connect != NULL &&
(conn->ssl_iostream == NULL ||
ssl_iostream_is_handshaked(conn->ssl_iostream)))
}
}
+ if (conn->connect_succeeded)
+ http_client_peer_connection_lost(peer);
i_free(conn);
*_conn = NULL;
-
- http_client_peer_connection_lost(peer);
}
void http_client_connection_switch_ioloop(struct http_client_connection *conn)
{
unsigned int num_urgent;
+ /* we get here when an already connected connection fails. if the
+ connect itself fails, http_client_peer_connection_failure() is
+ called instead. */
+
if (peer->destroyed)
return;
http_client_peer_debug(peer, "Lost a connection (%d connections left)",
array_count(&peer->conns));
- if (!peer->last_connect_failed) {
- /* if there are pending requests, create a new
- connection for them. */
- http_client_peer_handle_requests(peer);
- }
+ /* if there are pending requests for this peer, 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);
ARRAY_TYPE(http_client_request) request_wait_list;
unsigned int connected:1; /* connection is connected */
+ unsigned int connect_succeeded:1;
unsigned int closing:1;
unsigned int close_indicated:1;
unsigned int output_locked:1; /* output is locked; no pipelining */