From af1ce1a0ac08de8c172077238ec22f4c72ad2225 Mon Sep 17 00:00:00 2001 From: Radkesvat <134321679+radkesvat@users.noreply.github.com> Date: Tue, 14 May 2024 02:07:54 +0000 Subject: [PATCH] fixes related to new changes --- tunnels/adapters/connector/tcp/tcp_connector.c | 3 ++- tunnels/adapters/listener/tcp/tcp_listener.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tunnels/adapters/connector/tcp/tcp_connector.c b/tunnels/adapters/connector/tcp/tcp_connector.c index 4fe162f6..e3101399 100644 --- a/tunnels/adapters/connector/tcp/tcp_connector.c +++ b/tunnels/adapters/connector/tcp/tcp_connector.c @@ -171,7 +171,6 @@ static void upStream(tunnel_t *self, context_t *c) unsigned int bytes = bufLen(c->payload); int nwrite = hio_write(cstate->io, c->payload); c->payload = NULL; - destroyContext(c); if (nwrite >= 0 && nwrite < bytes) { @@ -179,6 +178,8 @@ static void upStream(tunnel_t *self, context_t *c) cstate->write_paused = true; hio_setcb_write(cstate->io, onWriteComplete); } + destroyContext(c); + } } else diff --git a/tunnels/adapters/listener/tcp/tcp_listener.c b/tunnels/adapters/listener/tcp/tcp_listener.c index 480b2c27..f1899a4e 100644 --- a/tunnels/adapters/listener/tcp/tcp_listener.c +++ b/tunnels/adapters/listener/tcp/tcp_listener.c @@ -172,7 +172,6 @@ static void downStream(tunnel_t *self, context_t *c) unsigned int bytes = bufLen(c->payload); int nwrite = hio_write(cstate->io, c->payload); c->payload = NULL; - destroyContext(c); if (nwrite >= 0 && nwrite < bytes) { @@ -180,6 +179,8 @@ static void downStream(tunnel_t *self, context_t *c) cstate->write_paused = true; hio_setcb_write(cstate->io, onWriteComplete); } + destroyContext(c); + } } else