]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
connection_disconnect(): Explicitly close input/output stream.
authorTimo Sirainen <tss@iki.fi>
Sun, 7 Apr 2013 12:10:36 +0000 (15:10 +0300)
committerTimo Sirainen <tss@iki.fi>
Sun, 7 Apr 2013 12:10:36 +0000 (15:10 +0300)
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.

src/lib/connection.c

index 91e714fa40b6b57163cc5d386bce9636d04c391a..a054219a822d7059b9caf9adabb7dc9d7c4510b6 100644 (file)
@@ -243,10 +243,14 @@ void connection_disconnect(struct connection *conn)
                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);