diff --git a/src/redir.c b/src/redir.c index 10b5ce55..d8a775bd 100644 --- a/src/redir.c +++ b/src/redir.c @@ -164,10 +164,8 @@ static void server_recv_cb(EV_P_ ev_io *w, int revents) // connection closed remote->buf_len = 0; remote->buf_idx = 0; + close_and_free_remote(EV_A_ remote); close_and_free_server(EV_A_ server); - if (remote != NULL) { - ev_io_start(EV_A_ & remote->send_ctx->io); - } return; } else if (r < 0) { if (errno == EAGAIN || errno == EWOULDBLOCK) { @@ -425,13 +423,7 @@ static void remote_send_cb(EV_P_ ev_io *w, int revents) remote->buf_len = 0; remote->buf_idx = 0; ev_io_stop(EV_A_ & remote_send_ctx->io); - if (server != NULL) { - ev_io_start(EV_A_ & server->recv_ctx->io); - } else { - close_and_free_remote(EV_A_ remote); - close_and_free_server(EV_A_ server); - return; - } + ev_io_start(EV_A_ & server->recv_ctx->io); } }