Browse Source

tune timeout

pull/196/merge
Max Lv 10 years ago
parent
commit
cd6a5e409d
4 changed files with 8 additions and 6 deletions
  1. 7
      src/local.c
  2. 2
      src/redir.c
  3. 2
      src/server.c
  4. 3
      src/tunnel.c

7
src/local.c

@ -688,9 +688,10 @@ static struct remote * new_remote(int fd, int timeout)
remote->fd = fd; remote->fd = fd;
ev_io_init(&remote->recv_ctx->io, remote_recv_cb, fd, EV_READ); ev_io_init(&remote->recv_ctx->io, remote_recv_cb, fd, EV_READ);
ev_io_init(&remote->send_ctx->io, remote_send_cb, fd, EV_WRITE); ev_io_init(&remote->send_ctx->io, remote_send_cb, fd, EV_WRITE);
ev_timer_init(&remote->send_ctx->watcher, remote_timeout_cb, timeout, 0);
ev_timer_init(&remote->recv_ctx->watcher, remote_timeout_cb, timeout,
timeout * 60);
ev_timer_init(&remote->send_ctx->watcher, remote_timeout_cb, min(5,
timeout), 0);
ev_timer_init(&remote->recv_ctx->watcher, remote_timeout_cb, min(10,
timeout), timeout);
remote->recv_ctx->remote = remote; remote->recv_ctx->remote = remote;
remote->send_ctx->remote = remote; remote->send_ctx->remote = remote;
return remote; return remote;

2
src/redir.c

@ -471,7 +471,7 @@ static struct remote * new_remote(int fd, int timeout)
remote->fd = fd; remote->fd = fd;
ev_io_init(&remote->recv_ctx->io, remote_recv_cb, fd, EV_READ); ev_io_init(&remote->recv_ctx->io, remote_recv_cb, fd, EV_READ);
ev_io_init(&remote->send_ctx->io, remote_send_cb, fd, EV_WRITE); ev_io_init(&remote->send_ctx->io, remote_send_cb, fd, EV_WRITE);
ev_timer_init(&remote->send_ctx->watcher, remote_timeout_cb, timeout, 0);
ev_timer_init(&remote->send_ctx->watcher, remote_timeout_cb, min(5, timeout), 0);
remote->recv_ctx->remote = remote; remote->recv_ctx->remote = remote;
remote->recv_ctx->connected = 0; remote->recv_ctx->connected = 0;
remote->send_ctx->remote = remote; remote->send_ctx->remote = remote;

2
src/server.c

@ -803,7 +803,7 @@ static struct server * new_server(int fd, struct listen_ctx *listener)
ev_io_init(&server->recv_ctx->io, server_recv_cb, fd, EV_READ); ev_io_init(&server->recv_ctx->io, server_recv_cb, fd, EV_READ);
ev_io_init(&server->send_ctx->io, server_send_cb, fd, EV_WRITE); ev_io_init(&server->send_ctx->io, server_send_cb, fd, EV_WRITE);
ev_timer_init(&server->recv_ctx->watcher, server_timeout_cb, ev_timer_init(&server->recv_ctx->watcher, server_timeout_cb,
listener->timeout, listener->timeout * 5);
min(10, listener->timeout), listener->timeout);
server->recv_ctx->server = server; server->recv_ctx->server = server;
server->recv_ctx->connected = 0; server->recv_ctx->connected = 0;
server->send_ctx->server = server; server->send_ctx->server = server;

3
src/tunnel.c

@ -466,7 +466,8 @@ static struct remote * new_remote(int fd, int timeout)
remote->fd = fd; remote->fd = fd;
ev_io_init(&remote->recv_ctx->io, remote_recv_cb, fd, EV_READ); ev_io_init(&remote->recv_ctx->io, remote_recv_cb, fd, EV_READ);
ev_io_init(&remote->send_ctx->io, remote_send_cb, fd, EV_WRITE); ev_io_init(&remote->send_ctx->io, remote_send_cb, fd, EV_WRITE);
ev_timer_init(&remote->send_ctx->watcher, remote_timeout_cb, timeout, 0);
ev_timer_init(&remote->send_ctx->watcher, remote_timeout_cb, min(5,
timeout), 0);
remote->recv_ctx->remote = remote; remote->recv_ctx->remote = remote;
remote->recv_ctx->connected = 0; remote->recv_ctx->connected = 0;
remote->send_ctx->remote = remote; remote->send_ctx->remote = remote;

Loading…
Cancel
Save