dovecot-2.2: connection_disconnect(): Explicitly close input/out...

dovecot at dovecot.org dovecot at dovecot.org
Sun Apr 7 15:10:51 EEST 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/cb2e3676547d
changeset: 16221:cb2e3676547d
user:      Timo Sirainen <tss at iki.fi>
date:      Sun Apr 07 15:10:36 2013 +0300
description:
connection_disconnect(): Explicitly close input/output stream.
This makes sure that if the ostream has some data pending and is still
referenced, the io_remove() won't be called after fd is already closed.

diffstat:

 src/lib/connection.c |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (20 lines):

diff -r 6bddc6d3530c -r cb2e3676547d src/lib/connection.c
--- a/src/lib/connection.c	Sun Apr 07 15:03:36 2013 +0300
+++ b/src/lib/connection.c	Sun Apr 07 15:10:36 2013 +0300
@@ -243,10 +243,14 @@
 		timeout_remove(&conn->to);
 	if (conn->io != NULL)
 		io_remove(&conn->io);
-	if (conn->input != NULL)
+	if (conn->input != NULL) {
+		i_stream_close(conn->input);
 		i_stream_destroy(&conn->input);
-	if (conn->output != NULL)
+	}
+	if (conn->output != NULL) {
+		o_stream_close(conn->output);
 		o_stream_destroy(&conn->output);
+	}
 	if (conn->fd_in != -1) {
 		if (close(conn->fd_in) < 0)
 			i_error("close(%s) failed: %m", conn->name);


More information about the dovecot-cvs mailing list