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:
parent
ad1adcb997
commit
42a5cede3a
12
redsocks.c
12
redsocks.c
@ -437,10 +437,16 @@ static void redsocks_accept_client(int fd, short what, void *_arg)
|
|||||||
log_errno("bufferevent_new");
|
log_errno("bufferevent_new");
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
client_fd = -1;
|
||||||
|
|
||||||
list_add(&client->list, &self->clients);
|
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)
|
if (self->relay_ss->connect_relay)
|
||||||
self->relay_ss->connect_relay(client);
|
self->relay_ss->connect_relay(client);
|
||||||
else
|
else
|
||||||
@ -449,9 +455,7 @@ static void redsocks_accept_client(int fd, short what, void *_arg)
|
|||||||
|
|
||||||
fail:
|
fail:
|
||||||
if (client) {
|
if (client) {
|
||||||
if (client->client)
|
redsocks_drop_client(client);
|
||||||
bufferevent_free(client->client);
|
|
||||||
free(client);
|
|
||||||
}
|
}
|
||||||
if (client_fd != -1)
|
if (client_fd != -1)
|
||||||
close(client_fd);
|
close(client_fd);
|
||||||
|
Loading…
Reference in New Issue
Block a user