changeset 20611:be966bc4b758

doveadm: Avoid recursively calling server input callback Probably doesn't fix anything, but it could cause confusing backtraces at least.
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Mon, 08 Aug 2016 19:22:15 +0300
parents faa75dd3298b
children e8a85457b96d
files src/doveadm/server-connection.c
diffstat 1 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/doveadm/server-connection.c	Mon Aug 08 19:16:57 2016 +0300
+++ b/src/doveadm/server-connection.c	Mon Aug 08 19:22:15 2016 +0300
@@ -42,6 +42,7 @@
 	struct istream *input;
 	struct ostream *output;
 	struct ssl_iostream *ssl_iostream;
+	struct timeout *to_input;
 
 	struct istream *cmd_input;
 	struct ostream *cmd_output;
@@ -76,9 +77,8 @@
 
 		conns[i]->io = io_add(conns[i]->fd, IO_READ,
 				      server_connection_input, conns[i]);
-		server_connection_input(conns[i]);
-		if (printing_conn != NULL)
-			break;
+		conns[i]->to_input = timeout_add_short(0,
+			server_connection_input, conns[i]);
 	}
 }
 
@@ -267,6 +267,9 @@
 {
 	const char *line;
 
+	if (conn->to_input != NULL)
+		timeout_remove(&conn->to_input);
+
 	if (!conn->handshaked) {
 		if ((line = i_stream_read_next_line(conn->input)) == NULL) {
 			if (conn->input->eof || conn->input->stream_errno != 0) {
@@ -512,6 +515,8 @@
 	if (printing_conn == conn)
 		print_connection_released();
 
+	if (conn->to_input != NULL)
+		timeout_remove(&conn->to_input);
 	if (conn->input != NULL)
 		i_stream_destroy(&conn->input);
 	if (conn->output != NULL)