dovecot-2.2: lib-imap-client: Make sure DNS lookups get aborted ...

dovecot at dovecot.org dovecot at dovecot.org
Thu Jun 6 12:21:23 EEST 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/612a679aeb03
changeset: 16471:612a679aeb03
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Jun 06 12:21:14 2013 +0300
description:
lib-imap-client: Make sure DNS lookups get aborted at disconnect.

diffstat:

 src/lib-imap-client/imapc-connection.c |  18 +++++++++++-------
 1 files changed, 11 insertions(+), 7 deletions(-)

diffs (37 lines):

diff -r d2756f3edb9c -r 612a679aeb03 src/lib-imap-client/imapc-connection.c
--- a/src/lib-imap-client/imapc-connection.c	Thu Jun 06 12:20:54 2013 +0300
+++ b/src/lib-imap-client/imapc-connection.c	Thu Jun 06 12:21:14 2013 +0300
@@ -352,7 +352,7 @@
 	bool reconnecting = conn->selected_box != NULL &&
 		conn->selected_box->reconnecting;
 
-	if (conn->fd == -1)
+	if (conn->state == IMAPC_CONNECTION_STATE_DISCONNECTED)
 		return;
 
 	if (conn->client->set.debug)
@@ -366,14 +366,18 @@
 		timeout_remove(&conn->to);
 	if (conn->to_output != NULL)
 		timeout_remove(&conn->to_output);
-	imap_parser_unref(&conn->parser);
-	io_remove(&conn->io);
+	if (conn->parser != NULL)
+		imap_parser_unref(&conn->parser);
+	if (conn->io != NULL)
+		io_remove(&conn->io);
 	if (conn->ssl_iostream != NULL)
 		ssl_iostream_unref(&conn->ssl_iostream);
-	i_stream_destroy(&conn->input);
-	o_stream_destroy(&conn->output);
-	net_disconnect(conn->fd);
-	conn->fd = -1;
+	if (conn->fd != -1) {
+		i_stream_destroy(&conn->input);
+		o_stream_destroy(&conn->output);
+		net_disconnect(conn->fd);
+		conn->fd = -1;
+	}
 
 	imapc_connection_set_state(conn, IMAPC_CONNECTION_STATE_DISCONNECTED);
 	imapc_connection_abort_commands(conn, NULL, reconnecting);


More information about the dovecot-cvs mailing list