Skip to content

Commit

Permalink
HevSocks5SessionUDP: 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 a20b727 commit 458df6e
Showing 1 changed file with 3 additions and 21 deletions.
24 changes: 3 additions & 21 deletions src/hev-socks5-session-udp.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <hev-task-mutex.h>
#include <hev-memory-allocator.h>
#include <hev-socks5-udp.h>
#include <hev-socks5-misc.h>
#include <hev-socks5-client-udp.h>

#include "hev-logger.h"
Expand All @@ -27,6 +28,8 @@

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

#define task_io_yielder hev_socks5_task_io_yielder

typedef struct _HevSocks5UDPFrame HevSocks5UDPFrame;

struct _HevSocks5UDPFrame
Expand Down Expand Up @@ -158,27 +161,6 @@ hev_socks5_session_udp_fwd_b (HevSocks5SessionUDP *self)
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_udp_splice (HevSocks5Session *base)
{
Expand Down

0 comments on commit 458df6e

Please sign in to comment.