]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imap, pop3: Forced disconnection of client didn't always close connection immediately.
authorTimo Sirainen <tss@iki.fi>
Mon, 28 Jun 2010 15:25:35 +0000 (16:25 +0100)
committerTimo Sirainen <tss@iki.fi>
Mon, 28 Jun 2010 15:25:35 +0000 (16:25 +0100)
--HG--
branch : HEAD

src/imap/imap-client.c
src/pop3/pop3-client.c

index 16d60c2d586d89b1eeac9481cb07ffd970182cd4..ff38c19fa60fd36a712cd92a9d7107951b5df38d 100644 (file)
@@ -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)
index 6e2510394f4806e2c09594c6261dd9703ffafd09..8c4a4cadc5108176b37e1eba72224a4cd8e16e63 100644 (file)
@@ -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, ...)