Skip to content

Commit c9a9495

Browse files
committed
Fix potential crash with SSL connections
Old IO wasn't removed before SSL handshake attempted to add it. Fixes: Panic: io_add(0x2) called twice fd=.., callback=.. -> ..
1 parent c11a2a5 commit c9a9495

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/client.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,9 @@ static void client_wait_connect(struct client *client)
142142
return;
143143
}
144144

145+
/* remove before ssl handshake */
146+
io_remove(&client->io);
147+
145148
if (conf.ssl) {
146149
if (ssl_ctx == NULL) {
147150
if (ssl_iostream_context_init_client(&conf.ssl_set, &ssl_ctx, &error) < 0)
@@ -160,7 +163,6 @@ static void client_wait_connect(struct client *client)
160163
client->rawlog_fd = o_stream_get_fd(client->output);
161164
}
162165

163-
io_remove(&client->io);
164166
client->io = io_add_istream(client->input, client_input, client);
165167
client->v.connected(client);
166168
}

0 commit comments

Comments
 (0)