Module: sip-router Branch: master Commit: c837bba9f6808141e6d23daaecdea06fee39fa8a URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=c837bba9...
Author: Peter Dunkley peter.dunkley@crocodile-rcs.com Committer: Peter Dunkley peter.dunkley@crocodile-rcs.com Date: Thu Dec 13 11:58:34 2012 +0000
modules/websocket: Fixed resource leak and infinite loop in websocket module
- Can occur when TCP connections go away without the WebSocket being closed properly.
---
modules/websocket/ws_conn.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/modules/websocket/ws_conn.c b/modules/websocket/ws_conn.c index dde1e25..0adde39 100644 --- a/modules/websocket/ws_conn.c +++ b/modules/websocket/ws_conn.c @@ -316,6 +316,9 @@ void wsconn_close_now(ws_connection_t *wsc) { struct tcp_connection *con = tcpconn_get(wsc->id, 0, 0, 0, 0);
+ if (wsconn_rm(wsc, WSCONN_EVENTROUTE_YES) < 0) + LM_ERR("removing WebSocket connection\n"); + if (con == NULL) { LM_ERR("getting TCP/TLS connection\n"); @@ -325,9 +328,6 @@ void wsconn_close_now(ws_connection_t *wsc) con->send_flags.f |= SND_F_CON_CLOSE; con->state = S_CONN_BAD; con->timeout = get_ticks_raw(); - - if (wsconn_rm(wsc, WSCONN_EVENTROUTE_YES) < 0) - LM_ERR("removing WebSocket connection\n"); }
ws_connection_t *wsconn_get(int id)