Module: kamailio
Branch: master
Commit: 30d372cd4b3dd2ed24456c49a6f69ecdc9b42f0e
URL:
https://github.com/kamailio/kamailio/commit/30d372cd4b3dd2ed24456c49a6f69ec…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2017-01-31T12:26:16+01:00
websocket: option to avoid repetitive logs each 1 sec during pinging
- few debug messages are printed each second while fetching the list of
active connections for pining, making the log full while
troubleshooting
---
Modified: src/modules/websocket/websocket.c
Modified: src/modules/websocket/ws_conn.c
---
Diff:
https://github.com/kamailio/kamailio/commit/30d372cd4b3dd2ed24456c49a6f69ec…
Patch:
https://github.com/kamailio/kamailio/commit/30d372cd4b3dd2ed24456c49a6f69ec…
---
diff --git a/src/modules/websocket/websocket.c b/src/modules/websocket/websocket.c
index 826c540..1466667 100644
--- a/src/modules/websocket/websocket.c
+++ b/src/modules/websocket/websocket.c
@@ -67,6 +67,8 @@ static int ws_keepalive_timeout = DEFAULT_KEEPALIVE_TIMEOUT;
#define DEFAULT_KEEPALIVE_PROCESSES 1
static int ws_keepalive_processes = DEFAULT_KEEPALIVE_PROCESSES;
+int ws_verbose_list = 0;
+
static cmd_export_t cmds[] = {
/* ws_frame.c */
{ "ws_close", (cmd_function) ws_close,
@@ -101,6 +103,7 @@ static param_export_t params[] = {
{ "keepalive_interval", INT_PARAM, &ws_keepalive_interval },
{ "keepalive_processes", INT_PARAM, &ws_keepalive_processes },
+ { "verbose_list", PARAM_INT, &ws_verbose_list },
{ 0, 0, 0 }
};
diff --git a/src/modules/websocket/ws_conn.c b/src/modules/websocket/ws_conn.c
index 4abe960..900847b 100644
--- a/src/modules/websocket/ws_conn.c
+++ b/src/modules/websocket/ws_conn.c
@@ -36,6 +36,8 @@
/* Maximum number of connections to display when using the ws.dump command */
#define MAX_WS_CONNS_DUMP 50
+extern int ws_verbose_list;
+
ws_connection_t **wsconn_id_hash = NULL;
#define wsconn_listadd tcpconn_listadd
#define wsconn_listrm tcpconn_listrm
@@ -454,7 +456,7 @@ ws_connection_t **wsconn_get_list(void)
size_t list_len = 0;
size_t i = 0;
- LM_DBG("wsconn_get_list\n");
+ if(ws_verbose_list) LM_DBG("wsconn get list - starting\n");
WSCONN_LOCK;
@@ -462,7 +464,8 @@ ws_connection_t **wsconn_get_list(void)
wsc = wsconn_used_list->head;
while (wsc)
{
- LM_DBG("counter wsc [%p] prev => [%p] next => [%p]\n", wsc,
wsc->used_prev, wsc->used_next);
+ if(ws_verbose_list) LM_DBG("counter wsc [%p] prev => [%p] next =>
[%p]\n",
+ wsc, wsc->used_prev, wsc->used_next);
list_len++;
wsc = wsc->used_next;
}
@@ -489,7 +492,7 @@ ws_connection_t **wsconn_get_list(void)
list[i] = wsc;
wsconn_ref(wsc);
- LM_DBG("wsc [%p] id [%d] ref++\n", wsc, wsc->id);
+ if(ws_verbose_list) LM_DBG("wsc [%p] id [%d] ref++\n", wsc, wsc->id);
wsc = wsc->used_next;
}
@@ -498,7 +501,8 @@ ws_connection_t **wsconn_get_list(void)
end:
WSCONN_UNLOCK;
- LM_DBG("wsconn_get_list returns list [%p] with [%d] members\n", list,
(int)list_len);
+ if(ws_verbose_list) LM_DBG("wsconn_get_list returns list [%p]"
+ " with [%d] members\n", list, (int)list_len);
return list;
}