diff --git a/src/local.c b/src/local.c index 1722775c..e93662a2 100644 --- a/src/local.c +++ b/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; diff --git a/src/redir.c b/src/redir.c index 30eaa221..9ebf916d 100644 --- a/src/redir.c +++ b/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; diff --git a/src/server.c b/src/server.c index 30a487c8..9d482368 100644 --- a/src/server.c +++ b/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 {