From: Timo Sirainen Date: Thu, 8 Jun 2023 13:16:06 +0000 (+0300) Subject: lib-master: Log more details if stats connection handshake times out X-Git-Tag: 2.4.0~2710 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=215959399f7d908473eba40c22bc67c7760a1482;p=thirdparty%2Fdovecot%2Fcore.git lib-master: Log more details if stats connection handshake times out --- diff --git a/src/lib-master/stats-client.c b/src/lib-master/stats-client.c index af72926645..2b1e4d7395 100644 --- a/src/lib-master/stats-client.c +++ b/src/lib-master/stats-client.c @@ -18,6 +18,7 @@ struct stats_client { struct event_filter *filter; struct ioloop *ioloop; struct timeout *to_reconnect; + struct timeval wait_started; bool handshaked; bool handshake_received_at_least_once; bool silent_notfound_errors; @@ -298,7 +299,11 @@ static void stats_global_deinit(void) static void stats_client_timeout(struct stats_client *client) { - e_error(client->conn.event, "Timeout waiting for handshake response"); + int diff_msecs = timeval_diff_msecs(&ioloop_timeval, + &client->wait_started); + e_error(client->conn.event, "Timeout waiting for handshake response " + "(waited %d.%03d secs%s)", diff_msecs / 1000, diff_msecs % 1000, + client->conn.version_received ? ", version received" : ""); io_loop_stop(client->ioloop); } @@ -310,6 +315,7 @@ static void stats_client_wait(struct stats_client *client) i_assert(client->to_reconnect == NULL); client->ioloop = io_loop_create(); + client->wait_started = ioloop_timeval; to = timeout_add(STATS_CLIENT_TIMEOUT_MSECS, stats_client_timeout, client); connection_switch_ioloop(&client->conn); io_loop_run(client->ioloop);