Skip to content

Commit

Permalink
lib-auth: auth-master - Create ioloop before connecting to the auth s…
Browse files Browse the repository at this point in the history
…ervice.
  • Loading branch information
stephanbosch committed Mar 8, 2019
1 parent 9e1f88a commit e45f726
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/lib-auth/auth-master.c
Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit e45f726

Please sign in to comment.