connection_closed(conn, CONNECTION_DISCONNECT_CONNECT_TIMEOUT);
}
-static void connection_input_parse_lines(struct connection *conn)
+static int connection_input_parse_lines(struct connection *conn)
{
const char *line;
struct istream *input;
} T_END;
if (ret <= 0)
break;
+ if (conn->input != input) {
+ /* Input handler changed the istream (and maybe
+ ostream?) Restart reading using the new streams. */
+ break;
+ }
}
if (output != NULL) {
o_stream_uncork(output);
reason = CONNECTION_DISCONNECT_DEINIT;
connection_closed(conn, reason);
}
+ if (input->closed)
+ ret = -1;
i_stream_unref(&input);
+ return ret;
}
void connection_input_default(struct connection *conn)
i_unreached();
}
- connection_input_parse_lines(conn);
+ while (connection_input_parse_lines(conn) > 0) ;
}
int connection_verify_version(struct connection *conn,