Module: kamailio
Branch: master
Commit: abe60832de46796a1395a75a67753c1a12a1ec0a
URL:
https://github.com/kamailio/kamailio/commit/abe60832de46796a1395a75a67753c1…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2022-09-16T14:51:31+02:00
websocket: clean up ws structures without an active tcp connection
- GH #3236
---
Modified: src/modules/websocket/ws_conn.c
---
Diff:
https://github.com/kamailio/kamailio/commit/abe60832de46796a1395a75a67753c1…
Patch:
https://github.com/kamailio/kamailio/commit/abe60832de46796a1395a75a67753c1…
---
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;
}