Skip to content

Commit

Permalink
HevSocks5SessionTCP: Use socks5 core task io yielder.
Browse files Browse the repository at this point in the history
  • Loading branch information
heiher committed May 19, 2021
1 parent efc5149 commit a20b727
Showing 1 changed file with 4 additions and 22 deletions.
26 changes: 4 additions & 22 deletions src/hev-socks5-session-tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,17 @@
#include <hev-task-io.h>
#include <hev-task-io-socket.h>
#include <hev-task-mutex.h>
#include <hev-socks5-client-tcp.h>
#include <hev-memory-allocator.h>
#include <hev-socks5-misc.h>
#include <hev-socks5-client-tcp.h>

#include "hev-logger.h"
#include "hev-config-const.h"

#include "hev-socks5-session-tcp.h"

#define task_io_yielder hev_socks5_task_io_yielder

static int
tcp_splice_f (HevSocks5SessionTCP *self)
{
Expand Down Expand Up @@ -111,27 +114,6 @@ tcp_splice_b (HevSocks5SessionTCP *self, uint8_t *buffer)
return 1;
}

static int
task_io_yielder (HevTaskYieldType type, void *data)
{
HevSocks5 *self = data;
int timeout;

timeout = self->timeout;

if (timeout < 0) {
hev_task_yield (HEV_TASK_WAITIO);
} else {
timeout = hev_task_sleep (timeout);
if (timeout <= 0) {
LOG_D ("%p io timeout", self);
return -1;
}
}

return 0;
}

static void
hev_socks5_session_tcp_splice (HevSocks5Session *base)
{
Expand Down

0 comments on commit a20b727

Please sign in to comment.