Skip to content

Commit

Permalink
HevSocks5Session: Log with session type.
Browse files Browse the repository at this point in the history
  • Loading branch information
heiher committed May 10, 2021
1 parent 925902b commit 52b8c22
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/hev-socks5-session.c
Original file line number Diff line number Diff line change
Expand Up @@ -925,12 +925,15 @@ socks5_do_fwd_dns (HevSocks5Session *self)
static int
socks5_close_session (HevSocks5Session *self)
{
const char *type = "";

if (self->remote_fd >= 0)
close (self->remote_fd);

hev_task_mutex_lock (self->mutex);
switch (self->type) {
case TYPE_TCP:
type = "TCP";
if (self->tcp) {
tcp_recv (self->tcp, NULL);
tcp_sent (self->tcp, NULL);
Expand All @@ -942,19 +945,21 @@ socks5_close_session (HevSocks5Session *self)
pbuf_free (self->queue);
break;
case TYPE_UDP:
type = "UDP";
if (self->udp) {
udp_remove (self->udp);
}
if (self->queue)
pbuf_free (self->queue);
break;
case TYPE_DNS:
type = "DNS";
pbuf_free (self->query);
break;
}
hev_task_mutex_unlock (self->mutex);

LOG_I ("Session %s: closed", self->saddr);
LOG_I ("Session %s: closed %s", self->saddr, type);

if (self->saddr)
hev_free (self->saddr);
Expand Down

0 comments on commit 52b8c22

Please sign in to comment.