Module: kamailio
Branch: 5.6
Commit: d59c64514f032a73a1f6aa65051f81b8784a5713
URL:
https://github.com/kamailio/kamailio/commit/d59c64514f032a73a1f6aa65051f81b…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2023-02-24T13:49:54+01:00
websocket: ignore keepalive in state WS_S_REMOVING
- GH #3331
(cherry picked from commit 34c3c42b7fe44dbe88110415ec78400a7defde61)
---
Modified: src/modules/websocket/ws_frame.c
---
Diff:
https://github.com/kamailio/kamailio/commit/d59c64514f032a73a1f6aa65051f81b…
Patch:
https://github.com/kamailio/kamailio/commit/d59c64514f032a73a1f6aa65051f81b…
---
diff --git a/src/modules/websocket/ws_frame.c b/src/modules/websocket/ws_frame.c
index 583e9040522..c7927b16f43 100644
--- a/src/modules/websocket/ws_frame.c
+++ b/src/modules/websocket/ws_frame.c
@@ -809,13 +809,18 @@ void ws_keepalive(unsigned int ticks, void *param)
LM_WARN("forcibly closing connection\n");
wsconn_close_now(wsc);
} else if (ws_keepalive_mechanism == KEEPALIVE_MECHANISM_CONCHECK) {
- tcp_connection_t *con = tcpconn_get(wsc->id, 0, 0, 0, 0);
- if(con==NULL) {
- LM_INFO("tcp connection has been lost (id: %d wsc: %p)\n",
+ if(wsc->state == WS_S_REMOVING) {
+ LM_DBG("ws (id: %d wsc: %p) in removing state ignoring keepalive\n",
wsc->id, wsc);
- wsc->state = WS_S_CLOSING;
} else {
- tcpconn_put(con);
+ tcp_connection_t *con = tcpconn_get(wsc->id, 0, 0, 0, 0);
+ if(con==NULL) {
+ LM_INFO("tcp connection has been lost (id: %d wsc: %p)\n",
+ wsc->id, wsc);
+ wsc->state = WS_S_CLOSING;
+ } else {
+ tcpconn_put(con);
+ }
}
} else {
int opcode = (ws_keepalive_mechanism == KEEPALIVE_MECHANISM_PING)