From 1c8b93fb072ef56feda3f6a000e57254a5b66ee7 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Mon, 17 Nov 2025 15:23:11 +0200 Subject: [PATCH] pop3c: Show the exact state where client timed out Many different states caused "Authentication timed out". --- src/lib-storage/index/pop3c/pop3c-client.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/lib-storage/index/pop3c/pop3c-client.c b/src/lib-storage/index/pop3c/pop3c-client.c index 244ba19b70..9f494f2ea0 100644 --- a/src/lib-storage/index/pop3c/pop3c-client.c +++ b/src/lib-storage/index/pop3c/pop3c-client.c @@ -37,8 +37,21 @@ enum pop3c_client_state { /* Post-authentication, asking for capabilities */ POP3C_CLIENT_STATE_CAPA, /* Authenticated, ready to accept commands */ - POP3C_CLIENT_STATE_DONE + POP3C_CLIENT_STATE_DONE, + + POP3C_CLIENT_STATE_COUNT +}; +static const char *pop3c_client_state_names[] = { + "disconnected", + "connecting", + "starttls", + "USER", + "AUTH", + "PASS", + "CAPA", + "authenticated", }; +static_assert_array_size(pop3c_client_state_names, POP3C_CLIENT_STATE_COUNT); struct pop3c_client_sync_cmd_ctx { enum pop3c_command_state state; @@ -231,7 +244,8 @@ static void pop3c_client_timeout(struct pop3c_client *client) break; default: e_error(client->event, - "Authentication timed out after %u seconds", + "Timed out in state %s after %u seconds", + pop3c_client_state_names[client->state], POP3C_CONNECT_TIMEOUT_MSECS/1000); break; } @@ -472,6 +486,7 @@ pop3c_client_prelogin_input_line(struct pop3c_client *client, const char *line) break; case POP3C_CLIENT_STATE_DISCONNECTED: case POP3C_CLIENT_STATE_DONE: + case POP3C_CLIENT_STATE_COUNT: i_unreached(); } return 0; -- 2.47.3