Skip to content

Commit 1af63d1

Browse files
committed
Remove connection from application connection list before tcp_destroy.
1 parent 5801c70 commit 1af63d1

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

tas/slow/appif_ctx.c

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,20 @@ void appif_conn_opened(struct connection *c, int status)
9494
kout->data.conn_opened.flow_id = c->flow_id;
9595
kout->data.conn_opened.fn_core = c->fn_core;
9696
} else {
97+
/* remove from app connection list */
98+
struct application *app = ctx->app;
99+
if (app->conns == c) {
100+
app->conns = c->app_next;
101+
} else {
102+
struct connection *c_crwl;
103+
for (c_crwl = app->conns; c_crwl != NULL && c_crwl->app_next != c;
104+
c_crwl = c_crwl->app_next);
105+
if (c_crwl == NULL) {
106+
fprintf(stderr, "appif_conn_closed: connection not found\n");
107+
abort();
108+
}
109+
c_crwl->app_next = c->app_next;
110+
}
97111
tcp_destroy(c);
98112
}
99113

@@ -215,6 +229,21 @@ void appif_accept_conn(struct connection *c, int status)
215229
c->app_next = app->conns;
216230
app->conns = c;
217231
} else {
232+
/* remove from app connection list */
233+
struct application *app = ctx->app;
234+
if (app->conns == c) {
235+
app->conns = c->app_next;
236+
} else {
237+
struct connection *c_crwl;
238+
for (c_crwl = app->conns; c_crwl != NULL && c_crwl->app_next != c;
239+
c_crwl = c_crwl->app_next);
240+
if (c_crwl == NULL) {
241+
fprintf(stderr, "appif_conn_closed: connection not found\n");
242+
abort();
243+
}
244+
c_crwl->app_next = c->app_next;
245+
}
246+
218247
tcp_destroy(c);
219248
}
220249

0 commit comments

Comments
 (0)