From: Timo Sirainen Date: Wed, 25 Oct 2017 14:22:42 +0000 (+0300) Subject: director: Close director connection immediately when output buffer is full X-Git-Tag: 2.3.0.rc1~623 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1511fc56b80709183cfa1201bfddd09d8a804c99;p=thirdparty%2Fdovecot%2Fcore.git director: Close director connection immediately when output buffer is full Only the ostream was closed, which didn't actually cause the disconnection until the other side closed the connection. --- diff --git a/src/director/director-connection.c b/src/director/director-connection.c index 45a1f3291d..e2c3ce6a54 100644 --- a/src/director/director-connection.c +++ b/src/director/director-connection.c @@ -2255,6 +2255,11 @@ static void director_connection_reconnect(struct director_connection **_conn, director_connect(dir, "Reconnecting after error"); } +static void director_disconnect_write_error(struct director_connection *conn) +{ + director_connection_deinit(&conn, "write failure"); +} + void director_connection_send(struct director_connection *conn, const char *data) { @@ -2279,6 +2284,11 @@ void director_connection_send(struct director_connection *conn, "disconnecting", conn->name); } o_stream_close(conn->output); + /* closing the stream when output buffer is full doesn't cause + disconnection itself. */ + timeout_remove(&conn->to_disconnect); + conn->to_disconnect = + timeout_add_short(0, director_disconnect_write_error, conn); } else { conn->dir->ring_traffic_output += len; }