From 7e50bd2d5ff95a2428b4dc1eca1828d94b816f24 Mon Sep 17 00:00:00 2001 From: Radkesvat <134321679+radkesvat@users.noreply.github.com> Date: Thu, 11 Apr 2024 17:48:40 +0300 Subject: [PATCH] fixes --- tunnels/client/reverse/reverse_client.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tunnels/client/reverse/reverse_client.c b/tunnels/client/reverse/reverse_client.c index 9b104557..094787c2 100644 --- a/tunnels/client/reverse/reverse_client.c +++ b/tunnels/client/reverse/reverse_client.c @@ -66,9 +66,12 @@ static inline void downStream(tunnel_t *self, context_t *c) } else { - state->unused_cons[tid] -= 1; + ucstate->pair_connected = true; + if (state->unused_cons[tid] > 0) + state->unused_cons[tid] -= 1; atomic_fetch_add_explicit(&(state->reverse_cons), 1, memory_order_relaxed); self->dw->downStream(self->dw, newInitContext(ucstate->d)); + if (CSTATE_U(c) == NULL) { reuseBuffer(buffer_pools[c->line->tid], c->payload); @@ -76,7 +79,6 @@ static inline void downStream(tunnel_t *self, context_t *c) destroyContext(c); return; } - ucstate->pair_connected = true; // first byte is 0xFF a signal from reverse server uint8_t check = 0x0;