Module: kamailio Branch: master Commit: 1acede64041307b783ed90736ca114917bafbc14 URL: https://github.com/kamailio/kamailio/commit/1acede64041307b783ed90736ca114917bafbc14
Author: Daniel-Constantin Mierla <mico...@gmail.com> Committer: Daniel-Constantin Mierla <mico...@gmail.com> Date: 2023-10-16T08:35:09+02:00 core: added tcp_check_timer parameter - set the check interval (in seconds) for tcp connections - default 10 --- Modified: src/core/cfg.lex Modified: src/core/cfg.y Modified: src/core/globals.h Modified: src/main.c --- Diff: https://github.com/kamailio/kamailio/commit/1acede64041307b783ed90736ca114917bafbc14.diff Patch: https://github.com/kamailio/kamailio/commit/1acede64041307b783ed90736ca114917bafbc14.patch --- diff --git a/src/core/cfg.lex b/src/core/cfg.lex index c8548c4eb6a..44c62279b7d 100644 --- a/src/core/cfg.lex +++ b/src/core/cfg.lex @@ -367,6 +367,7 @@ MAXSNDBUFFER maxsndbuffer SQL_BUFFER_SIZE sql_buffer_size MSG_RECV_MAX_SIZE msg_recv_max_size TCP_MSG_READ_TIMEOUT tcp_msg_read_timeout +TCP_CHECK_TIMER tcp_check_timer CHILDREN children SOCKET socket BIND bind @@ -854,6 +855,7 @@ IMPORTFILE "import_file" <INITIAL>{SQL_BUFFER_SIZE} { count(); yylval.strval=yytext; return SQL_BUFFER_SIZE; } <INITIAL>{MSG_RECV_MAX_SIZE} { count(); yylval.strval=yytext; return MSG_RECV_MAX_SIZE; } <INITIAL>{TCP_MSG_READ_TIMEOUT} { count(); yylval.strval=yytext; return TCP_MSG_READ_TIMEOUT; } +<INITIAL>{TCP_CHECK_TIMER} { count(); yylval.strval=yytext; return TCP_CHECK_TIMER; } <INITIAL>{CHILDREN} { count(); yylval.strval=yytext; return CHILDREN; } <INITIAL>{SOCKET} { count(); yylval.strval=yytext; return SOCKET; } <INITIAL>{BIND} { count(); yylval.strval=yytext; return BIND; } diff --git a/src/core/cfg.y b/src/core/cfg.y index 9c7efd83f92..a5e16e259e1 100644 --- a/src/core/cfg.y +++ b/src/core/cfg.y @@ -423,6 +423,7 @@ extern char *default_routename; %token SQL_BUFFER_SIZE %token MSG_RECV_MAX_SIZE %token TCP_MSG_READ_TIMEOUT +%token TCP_CHECK_TIMER %token USER %token GROUP %token CHROOT @@ -1019,6 +1020,8 @@ assign_stm: | MSG_RECV_MAX_SIZE EQUAL error { yyerror("number expected"); } | TCP_MSG_READ_TIMEOUT EQUAL NUMBER { ksr_tcp_msg_read_timeout=$3; } | TCP_MSG_READ_TIMEOUT EQUAL error { yyerror("number expected"); } + | TCP_CHECK_TIMER EQUAL NUMBER { ksr_tcp_check_timer=$3; } + | TCP_CHECK_TIMER EQUAL error { yyerror("number expected"); } | CHILDREN EQUAL NUMBER { children_no=$3; } | CHILDREN EQUAL error { yyerror("number expected"); } | STATS_NAMESEP EQUAL STRING { ksr_stats_namesep=$3; } diff --git a/src/core/globals.h b/src/core/globals.h index 91c97ae9a4a..aac82563d51 100644 --- a/src/core/globals.h +++ b/src/core/globals.h @@ -240,6 +240,7 @@ extern int ksr_rpc_exec_delta; extern int ksr_msg_recv_max_size; extern int ksr_tcp_msg_read_timeout; +extern int ksr_tcp_check_timer; #ifdef USE_DNS_CACHE extern int diff --git a/src/main.c b/src/main.c index 719debba099..a949d930407 100644 --- a/src/main.c +++ b/src/main.c @@ -532,6 +532,7 @@ char *pgid_file = 0; int ksr_msg_recv_max_size = 32767; /* 2^15 - 1 */ int ksr_tcp_msg_read_timeout = KSR_TCP_MSGREAD_TIMEOUT; +int ksr_tcp_check_timer = 10; /* seconds to check tcp connections */ /* memory manager */ #define SR_MEMMNG_DEFAULT "qm" @@ -1722,8 +1723,10 @@ int main_loop(void) cfg_main_reset_local(); #ifdef USE_TCP - if(!tcp_disable) { - if(sr_wtimer_add(tcp_timer_check_connections, NULL, 10) < 0) { + if(!tcp_disable && ksr_tcp_check_timer > 0) { + if(sr_wtimer_add( + tcp_timer_check_connections, NULL, ksr_tcp_check_timer) + < 0) { LM_CRIT("cannot add timer for tcp connection checks\n"); goto error; } _______________________________________________ Kamailio (SER) - Development Mailing List To unsubscribe send an email to sr-dev-le...@lists.kamailio.org