Skip to content

Commit

Permalink
doveadm: Avoid recursively calling server input callback
Browse files Browse the repository at this point in the history
Probably doesn't fix anything, but it could cause confusing backtraces at
least.
  • Loading branch information
sirainen committed Aug 8, 2016
1 parent efb991a commit fb163f4
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/doveadm/server-connection.c
Expand Up @@ -42,6 +42,7 @@ struct server_connection {
struct istream *input;
struct ostream *output;
struct ssl_iostream *ssl_iostream;
struct timeout *to_input;

struct istream *cmd_input;
struct ostream *cmd_output;
Expand Down Expand Up @@ -76,9 +77,8 @@ static void print_connection_released(void)

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]);
}
}

Expand Down Expand Up @@ -267,6 +267,9 @@ static void server_connection_input(struct server_connection *conn)
{
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) {
Expand Down Expand Up @@ -512,6 +515,8 @@ void server_connection_destroy(struct server_connection **_conn)
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)
Expand Down

0 comments on commit fb163f4

Please sign in to comment.