From abe60832de46796a1395a75a67753c1a12a1ec0a Mon Sep 17 00:00:00 2001 From: Daniel-Constantin Mierla Date: Fri, 16 Sep 2022 14:51:31 +0200 Subject: [PATCH] websocket: clean up ws structures without an active tcp connection - GH #3236 --- src/modules/websocket/ws_conn.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/modules/websocket/ws_conn.c b/src/modules/websocket/ws_conn.c index 7ffedd9be58..0015dfa778d 100644 --- a/src/modules/websocket/ws_conn.c +++ b/src/modules/websocket/ws_conn.c @@ -679,6 +679,7 @@ void ws_timer(unsigned int ticks, void *param) ws_connection_list_t rmlist; ws_connection_t *wsc; ws_connection_t *next; + struct tcp_connection *con = NULL; ticks_t nticks; int h; @@ -695,6 +696,15 @@ void ws_timer(unsigned int ticks, void *param) wsconn_detach_connection(wsc); wsc->id_next = rmlist.head; rmlist.head = wsc; + } else if(wsc->state != WS_S_REMOVING) { + con = tcpconn_get(wsc->id, 0, 0, 0, 0); + if(con == NULL) { + LM_DBG("ws structure without active tcp connection\n"); + wsc->state = WS_S_REMOVING; + wsc->rmticks = get_ticks(); + } else { + tcpconn_put(con); + } } wsc = next; }