]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-http: Added more debug messages.
authorTimo Sirainen <tss@iki.fi>
Thu, 27 Jun 2013 20:07:20 +0000 (23:07 +0300)
committerTimo Sirainen <tss@iki.fi>
Thu, 27 Jun 2013 20:07:20 +0000 (23:07 +0300)
src/lib-http/http-client-connection.c
src/lib-http/http-client-peer.c

index 3bb82c9150bd29043af3d02e018a0f40fe0d1e24..3fc644f7234d6c1bcbab00a9b565c5c75ade0cc8 100644 (file)
@@ -111,6 +111,8 @@ http_client_connection_abort_error(struct http_client_connection **_conn,
        struct http_client_connection *conn = *_conn;
        struct http_client_request **req;
 
+       http_client_connection_debug(conn, "Aborting connection: %s", error);
+
        conn->connected = FALSE;
        conn->closing = TRUE;
        
@@ -146,6 +148,9 @@ http_client_connection_abort_temp_error(struct http_client_connection **_conn,
                }
        }
 
+       http_client_connection_debug(conn,
+               "Aborting connection with temporary error: %s", error);
+
        conn->connected = FALSE;
        conn->closing = TRUE;
        
@@ -341,6 +346,7 @@ static void http_client_connection_destroy(struct connection *_conn)
                                "SSL handshaking to %s failed: Connection timed out in %u.%03u secs",
                                _conn->name, msecs/1000, msecs%1000);
                }
+               http_client_connection_debug(conn, "%s", error);
                http_client_connection_retry_requests(conn,
                        HTTP_CLIENT_REQUEST_ERROR_TIMED_OUT, error);
                break;
@@ -349,6 +355,7 @@ static void http_client_connection_destroy(struct connection *_conn)
                error = _conn->input == NULL ? "Connection lost" :
                        t_strdup_printf("Connection lost: %s",
                                        strerror(_conn->input->stream_errno));
+               http_client_connection_debug(conn, "%s", error);
                http_client_connection_retry_requests(conn,
                        HTTP_CLIENT_REQUEST_ERROR_CONNECTION_LOST, error);
        default:
@@ -784,6 +791,7 @@ http_client_connection_connected(struct connection *_conn, bool success)
                if (conn->peer->addr.https_name != NULL) {
                        if (http_client_connection_ssl_init(conn, &error) < 0) {
                                http_client_peer_connection_failure(conn->peer, error);
+                               http_client_connection_debug(conn, "%s", error);
                                http_client_connection_unref(&conn);
                        }
                        return;
@@ -833,6 +841,7 @@ static void http_client_connection_connect(struct http_client_connection *conn)
        conn->connect_start_timestamp = ioloop_timeval;
        if (connection_client_connect(&conn->conn) < 0) {
                conn->connect_errno = errno;
+               http_client_connection_debug(conn, "Connect failed: %m");
                conn->to_input = timeout_add_short(0,
                        http_client_connection_delayed_connect_error, conn);
                return;
index 8d33bee9701fe3e7de9b5e364fbb87eb3259eddd..373c175fc745752e79606e992ba77240e78e7acb 100644 (file)
@@ -135,8 +135,12 @@ http_client_peer_next_request(struct http_client_peer *peer)
        if (num_urgent == 0 &&
            working_conn_count >= peer->client->set.max_parallel_connections) {
                /* no */
-               if (conn == NULL)
+               if (conn == NULL) {
+                       http_client_peer_debug(peer,
+                               "Only non-urgent requests, and we already have "
+                               "%u pending connections", working_conn_count);
                        return FALSE;
+               }
                /* pipeline it */
                return http_client_connection_next_request(conn);
        }
@@ -152,6 +156,11 @@ http_client_peer_next_request(struct http_client_peer *peer)
        } else {
                new_connections = (num_urgent > connecting ? num_urgent - connecting : 0);
        }
+       http_client_peer_debug(peer,
+               "Creating %u new connections to handle requests "
+               "(already %u usable, connecting to %u, closing %u)",
+               new_connections, working_conn_count - connecting,
+               connecting, closing);
        http_client_peer_connect(peer, new_connections);
 
        /* now we wait until it is connected */