Browse Source

make sure index is set to zero

pull/4/merge
Max Lv 11 years ago
parent
commit
0b1ed4f8f4
3 changed files with 6 additions and 0 deletions
  1. 2
      src/local.c
  2. 2
      src/redir.c
  3. 2
      src/server.c

2
src/local.c

@ -132,6 +132,7 @@ static void server_recv_cb (EV_P_ ev_io *w, int revents) {
if (errno == EAGAIN || errno == EWOULDBLOCK) {
// no data, wait for send
remote->buf_len = r;
remote->buf_idx = 0;
ev_io_stop(EV_A_ &server_recv_ctx->io);
ev_io_start(EV_A_ &remote->send_ctx->io);
return;
@ -344,6 +345,7 @@ static void remote_recv_cb (EV_P_ ev_io *w, int revents) {
if (errno == EAGAIN || errno == EWOULDBLOCK) {
// no data, wait for send
server->buf_len = r;
server->buf_idx = 0;
ev_io_stop(EV_A_ &remote_recv_ctx->io);
ev_io_start(EV_A_ &server->send_ctx->io);
return;

2
src/redir.c

@ -142,6 +142,7 @@ static void server_recv_cb (EV_P_ ev_io *w, int revents) {
if (errno == EAGAIN || errno == EWOULDBLOCK) {
// no data, wait for send
remote->buf_len = r;
remote->buf_idx = 0;
ev_io_stop(EV_A_ &server_recv_ctx->io);
ev_io_start(EV_A_ &remote->send_ctx->io);
return;
@ -261,6 +262,7 @@ static void remote_recv_cb (EV_P_ ev_io *w, int revents) {
if (errno == EAGAIN || errno == EWOULDBLOCK) {
// no data, wait for send
server->buf_len = r;
server->buf_idx = 0;
ev_io_stop(EV_A_ &remote_recv_ctx->io);
ev_io_start(EV_A_ &server->send_ctx->io);
return;

2
src/server.c

@ -163,6 +163,7 @@ static void server_recv_cb (EV_P_ ev_io *w, int revents) {
if (errno == EAGAIN || errno == EWOULDBLOCK) {
// no data, wait for send
remote->buf_len = r;
remote->buf_idx = 0;
ev_io_stop(EV_A_ &server_recv_ctx->io);
ev_io_start(EV_A_ &remote->send_ctx->io);
} else {
@ -469,6 +470,7 @@ static void remote_recv_cb (EV_P_ ev_io *w, int revents) {
if (errno == EAGAIN || errno == EWOULDBLOCK) {
// no data, wait for send
server->buf_len = r;
server->buf_idx = 0;
ev_io_stop(EV_A_ &remote_recv_ctx->io);
ev_io_start(EV_A_ &server->send_ctx->io);
} else {

Loading…
Cancel
Save