0
0
mirror of https://github.com/darkk/redsocks.git synced 2025-08-27 20:25:30 +00:00

Fixed handling EOF from client while connection is ongoing.

This commit is contained in:
Leonid Evdokimov 2008-02-02 01:48:19 +06:00
parent ad1adcb997
commit 42a5cede3a

View File

@ -437,9 +437,15 @@ static void redsocks_accept_client(int fd, short what, void *_arg)
log_errno("bufferevent_new");
goto fail;
}
client_fd = -1;
list_add(&client->list, &self->clients);
// now it's safe to redsocks_drop_client
// enable reading to handle EOF from client
if (bufferevent_enable(client->client, EV_READ) != 0) {
log_errno("bufferevent_enable");
goto fail;
}
if (self->relay_ss->connect_relay)
self->relay_ss->connect_relay(client);
@ -449,9 +455,7 @@ static void redsocks_accept_client(int fd, short what, void *_arg)
fail:
if (client) {
if (client->client)
bufferevent_free(client->client);
free(client);
redsocks_drop_client(client);
}
if (client_fd != -1)
close(client_fd);