Module: kamailio
Branch: master
Commit: 34c3c42b7fe44dbe88110415ec78400a7defde61
URL:
https://github.com/kamailio/kamailio/commit/34c3c42b7fe44dbe88110415ec78400…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2023-01-16T12:55:34+01:00
websocket: ignore keepalive in state WS_S_REMOVING
- GH #3331
---
Modified: src/modules/websocket/ws_frame.c
---
Diff:
https://github.com/kamailio/kamailio/commit/34c3c42b7fe44dbe88110415ec78400…
Patch:
https://github.com/kamailio/kamailio/commit/34c3c42b7fe44dbe88110415ec78400…
---
diff --git a/src/modules/websocket/ws_frame.c b/src/modules/websocket/ws_frame.c
index 583e904052..c7927b16f4 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)