Browse Source

Fix #1008

pull/1011/head
Max Lv 8 years ago
parent
commit
32f52dabf9
4 changed files with 29 additions and 13 deletions
  1. 10
      src/local.c
  2. 10
      src/redir.c
  3. 10
      src/server.c
  4. 12
      src/tunnel.c

10
src/local.c

@ -856,6 +856,7 @@ remote_recv_cb(EV_P_ ev_io *w, int revents)
ERROR("remote_recv_cb_send");
close_and_free_remote(EV_A_ remote);
close_and_free_server(EV_A_ server);
return;
}
} else if (s < (int)(server->buf->len)) {
server->buf->len -= s;
@ -865,9 +866,12 @@ remote_recv_cb(EV_P_ ev_io *w, int revents)
}
// Disable TCP_NODELAY after the first response are sent
int opt = 0;
setsockopt(server->fd, SOL_TCP, TCP_NODELAY, &opt, sizeof(opt));
setsockopt(remote->fd, SOL_TCP, TCP_NODELAY, &opt, sizeof(opt));
if (!remote->recv_ctx->connected) {
int opt = 0;
setsockopt(server->fd, SOL_TCP, TCP_NODELAY, &opt, sizeof(opt));
setsockopt(remote->fd, SOL_TCP, TCP_NODELAY, &opt, sizeof(opt));
remote->recv_ctx->connected = 1;
}
}
static void

10
src/redir.c

@ -392,6 +392,7 @@ remote_recv_cb(EV_P_ ev_io *w, int revents)
ERROR("send");
close_and_free_remote(EV_A_ remote);
close_and_free_server(EV_A_ server);
return;
}
} else if (s < server->buf->len) {
server->buf->len -= s;
@ -401,9 +402,12 @@ remote_recv_cb(EV_P_ ev_io *w, int revents)
}
// Disable TCP_NODELAY after the first response are sent
int opt = 0;
setsockopt(server->fd, SOL_TCP, TCP_NODELAY, &opt, sizeof(opt));
setsockopt(remote->fd, SOL_TCP, TCP_NODELAY, &opt, sizeof(opt));
if (!remote->recv_ctx->connected) {
int opt = 0;
setsockopt(server->fd, SOL_TCP, TCP_NODELAY, &opt, sizeof(opt));
setsockopt(remote->fd, SOL_TCP, TCP_NODELAY, &opt, sizeof(opt));
remote->recv_ctx->connected = 1;
}
}
static void

10
src/server.c

@ -1200,6 +1200,7 @@ remote_recv_cb(EV_P_ ev_io *w, int revents)
ERROR("remote_recv_send");
close_and_free_remote(EV_A_ remote);
close_and_free_server(EV_A_ server);
return;
}
} else if (s < server->buf->len) {
server->buf->len -= s;
@ -1209,9 +1210,12 @@ remote_recv_cb(EV_P_ ev_io *w, int revents)
}
// Disable TCP_NODELAY after the first response are sent
int opt = 0;
setsockopt(server->fd, SOL_TCP, TCP_NODELAY, &opt, sizeof(opt));
setsockopt(remote->fd, SOL_TCP, TCP_NODELAY, &opt, sizeof(opt));
if (!remote->recv_ctx->connected) {
int opt = 0;
setsockopt(server->fd, SOL_TCP, TCP_NODELAY, &opt, sizeof(opt));
setsockopt(remote->fd, SOL_TCP, TCP_NODELAY, &opt, sizeof(opt));
remote->recv_ctx->connected = 1;
}
}
static void

12
src/tunnel.c

@ -350,6 +350,7 @@ remote_recv_cb(EV_P_ ev_io *w, int revents)
ERROR("send");
close_and_free_remote(EV_A_ remote);
close_and_free_server(EV_A_ server);
return;
}
} else if (s < server->buf->len) {
server->buf->len -= s;
@ -358,10 +359,13 @@ remote_recv_cb(EV_P_ ev_io *w, int revents)
ev_io_start(EV_A_ & server->send_ctx->io);
}
// Disable TCP_NODELAY after the first response are sent
int opt = 0;
setsockopt(server->fd, SOL_TCP, TCP_NODELAY, &opt, sizeof(opt));
setsockopt(remote->fd, SOL_TCP, TCP_NODELAY, &opt, sizeof(opt));
if (!remote->recv_ctx->connected) {
// Disable TCP_NODELAY after the first response are sent
int opt = 0;
setsockopt(server->fd, SOL_TCP, TCP_NODELAY, &opt, sizeof(opt));
setsockopt(remote->fd, SOL_TCP, TCP_NODELAY, &opt, sizeof(opt));
remote->recv_ctx->connected = 1;
}
}
static void

Loading…
Cancel
Save