Skip to content

Commit

Permalink
lib-imap-client: Fix IO after enabling SSL
Browse files Browse the repository at this point in the history
io_add_istream() needs to be used with the SSL istream, otherwise it can
cause hangs.
  • Loading branch information
sirainen authored and villesavolainen committed Feb 22, 2018
1 parent fb9d37d commit 2486b2e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/lib-imap-client/imapc-connection.c
Expand Up @@ -1657,6 +1657,7 @@ static int imapc_connection_ssl_init(struct imapc_connection *conn)
conn->output = conn->raw_output;
}

io_remove(&conn->io);
if (io_stream_create_ssl_client(conn->client->ssl_ctx,
conn->client->set.host,
&ssl_set, &conn->input, &conn->output,
Expand All @@ -1665,6 +1666,7 @@ static int imapc_connection_ssl_init(struct imapc_connection *conn)
conn->name, error);
return -1;
}
conn->io = io_add_istream(conn->input, imapc_connection_input, conn);
ssl_iostream_set_handshake_callback(conn->ssl_iostream,
imapc_connection_ssl_handshaked,
conn);
Expand Down

0 comments on commit 2486b2e

Please sign in to comment.