From e45f72690b298beed13b4d54361c68a4daac1f86 Mon Sep 17 00:00:00 2001 From: Stephan Bosch Date: Tue, 5 Mar 2019 00:48:11 +0100 Subject: [PATCH] lib-auth: auth-master - Create ioloop before connecting to the auth service. --- src/lib-auth/auth-master.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/lib-auth/auth-master.c b/src/lib-auth/auth-master.c index be67631ce6..753df511b3 100644 --- a/src/lib-auth/auth-master.c +++ b/src/lib-auth/auth-master.c @@ -411,7 +411,8 @@ static void auth_master_set_io(struct auth_master_connection *conn) conn->prev_ioloop = current_ioloop; conn->ioloop = io_loop_create(); connection_switch_ioloop_to(&conn->conn, conn->ioloop); - connection_input_resume(&conn->conn); + if (conn->connected) + connection_input_resume(&conn->conn); conn->to = timeout_add_to(conn->ioloop, conn->timeout_msecs, auth_request_timeout, conn); @@ -457,12 +458,16 @@ static bool is_valid_string(const char *str) static int auth_master_run_cmd_pre(struct auth_master_connection *conn, const char *cmd) { + auth_master_set_io(conn); + if (!conn->connected) { - if (auth_master_connect(conn) < 0) + if (auth_master_connect(conn) < 0) { + auth_master_unset_io(conn); return -1; + } i_assert(conn->connected); + connection_input_resume(&conn->conn); } - auth_master_set_io(conn); o_stream_cork(conn->conn.output); if (!conn->sent_handshake) {