From: Timo Sirainen Date: Mon, 28 Jun 2010 15:25:35 +0000 (+0100) Subject: imap, pop3: Forced disconnection of client didn't always close connection immediately. X-Git-Tag: 2.0.rc1~73 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ae18724030c4ce75348dced322c82e6dc8cc0862;p=thirdparty%2Fdovecot%2Fcore.git imap, pop3: Forced disconnection of client didn't always close connection immediately. --HG-- branch : HEAD --- diff --git a/src/imap/imap-client.c b/src/imap/imap-client.c index 16d60c2d58..ff38c19fa6 100644 --- a/src/imap/imap-client.c +++ b/src/imap/imap-client.c @@ -227,6 +227,11 @@ void client_destroy(struct client *client, const char *reason) imap_refresh_proctitle(); } +static void client_destroy_timeout(struct client *client) +{ + client_destroy(client, NULL); +} + void client_disconnect(struct client *client, const char *reason) { i_assert(reason != NULL); @@ -240,6 +245,10 @@ void client_disconnect(struct client *client, const char *reason) i_stream_close(client->input); o_stream_close(client->output); + + if (client->to_idle != NULL) + timeout_remove(&client->to_idle); + client->to_idle = timeout_add(0, client_destroy_timeout, client); } void client_disconnect_with_error(struct client *client, const char *msg) diff --git a/src/pop3/pop3-client.c b/src/pop3/pop3-client.c index 6e2510394f..8c4a4cadc5 100644 --- a/src/pop3/pop3-client.c +++ b/src/pop3/pop3-client.c @@ -435,6 +435,11 @@ void client_destroy(struct client *client, const char *reason) pop3_refresh_proctitle(); } +static void client_destroy_timeout(struct client *client) +{ + client_destroy(client, NULL); +} + void client_disconnect(struct client *client, const char *reason) { if (client->disconnected) @@ -447,6 +452,10 @@ void client_disconnect(struct client *client, const char *reason) i_stream_close(client->input); o_stream_close(client->output); + + if (client->to_idle != NULL) + timeout_remove(&client->to_idle); + client->to_idle = timeout_add(0, client_destroy_timeout, client); } int client_send_line(struct client *client, const char *fmt, ...)