Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
radkesvat committed Apr 4, 2024
1 parent 0dac1ec commit 410f8ad
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions tunnels/client/preconnect/preconnect_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,9 @@ static inline void upStream(tunnel_t *self, context_t *c)
case connected_pair:;
line_t *u_line = dcon->u;
(dcon->u->chains_state)[self->chain_index] = NULL;
context_t * fctx = switchLine(c, u_line); // created here to prevent destruction of line
destroy_cstate(dcon);
self->up->upStream(self->up, switchLine(c, u_line));
self->up->upStream(self->up,fctx);
break;
case notconnected:
default:
Expand Down Expand Up @@ -122,10 +123,10 @@ static inline void downStream(tunnel_t *self, context_t *c)
const unsigned int tid = c->line->tid;
thread_box_t *this_tb = &(state->threads[tid]);
preconnect_client_con_state_t *ucon = CSTATE(c);
CSTATE_MUT(c) = NULL;

if (c->fin)
{
CSTATE_MUT(c) = NULL;

switch (ucon->mode)
{
Expand All @@ -144,8 +145,12 @@ static inline void downStream(tunnel_t *self, context_t *c)
break;

case notconnected:
atomic_fetch_add_explicit(&(state->unused_cons), -1, memory_order_relaxed);
remove_connection(this_tb, ucon);
if (ucon->prev != NULL)
{
// fin after est
atomic_fetch_add_explicit(&(state->unused_cons), -1, memory_order_relaxed);
remove_connection(this_tb, ucon);
}
destroy_cstate(ucon);
destroyContext(c);
break;
Expand Down Expand Up @@ -246,5 +251,5 @@ tunnel_t *destroyPreConnectClient(tunnel_t *self)
}
tunnel_metadata_t getMetadataPreConnectClient()
{
return (tunnel_metadata_t){.version = 0001, .flags = TFLAG_ROUTE_STARTER};
return (tunnel_metadata_t){.version = 0001, .flags = 0x0};
}

0 comments on commit 410f8ad

Please sign in to comment.