From 3261098384056f3d82d823e614598ef1d5e578e7 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Wed, 16 Apr 2025 12:09:40 -0400 Subject: [PATCH] MT#55283 scale timeout Change-Id: I23628cfcf4e5044300a01c1e15591746467df1ba --- daemon/call.c | 4 ++-- daemon/cli.c | 6 +++--- daemon/main.c | 8 +++++--- include/main.h | 2 +- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/daemon/call.c b/daemon/call.c index e6ce9cb32..8538788e0 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -174,7 +174,7 @@ static void call_timer_iterator(call_t *c, struct iterator_helper *hlp) { // ignore media timeout if call was recently taken over if (CALL_ISSET(c, FOREIGN_MEDIA) - && rtpe_now - c->last_signal_us <= atomic_get_na(&rtpe_config.timeout) * 1000000L) // XXX scale to micro + && rtpe_now - c->last_signal_us <= atomic_get_na(&rtpe_config.timeout_us)) goto out; ice_fragments_cleanup(c->sdp_fragments, false); @@ -237,7 +237,7 @@ no_sfd: if (good) goto next; - check = atomic_get_na(&rtpe_config.timeout) * 1000000LL; // XXX scale to micro + check = atomic_get_na(&rtpe_config.timeout_us); tmp_t_reason = TIMEOUT; if (!MEDIA_ISSET(ps->media, RECV) || !sfd) { check = atomic_get_na(&rtpe_config.silent_timeout_us); diff --git a/daemon/cli.c b/daemon/cli.c index 508dd149e..1b66b2108 100644 --- a/daemon/cli.c +++ b/daemon/cli.c @@ -514,7 +514,7 @@ RTPE_CONFIG_ENDPOINT_QUEUE_PARAMS X(cpu_limit, "max-cpu") \ X(load_limit, "max-load") \ X(bw_limit, "max-bw") \ - X(timeout, "timeout") \ + X(timeout_us, "timeout") \ X(silent_timeout_us, "silent-timeout") \ X(final_timeout, "final-timeout") \ X(control_tos, "control-tos") \ @@ -651,7 +651,7 @@ static void cli_incoming_list_maxopenfiles(str *instr, struct cli_writer *cw, co } static void cli_incoming_list_timeout(str *instr, struct cli_writer *cw, const cli_handler_t *handler) { - cw->cw_printf(cw, "TIMEOUT=%u\n", rtpe_config.timeout); + cw->cw_printf(cw, "TIMEOUT=%" PRId64 "\n", rtpe_config.timeout_us / 1000000L); } static void cli_incoming_list_silenttimeout(str *instr, struct cli_writer *cw, const cli_handler_t *handler) { cw->cw_printf(cw, "SILENT_TIMEOUT=%" PRId64 "\n", rtpe_config.silent_timeout_us / 1000000L); @@ -1078,7 +1078,7 @@ static void cli_incoming_set_gentimeout_us(str *instr, struct cli_writer *cw, in } static void cli_incoming_set_timeout(str *instr, struct cli_writer *cw, const cli_handler_t *handler) { - cli_incoming_set_gentimeout(instr, cw, &rtpe_config.timeout); + cli_incoming_set_gentimeout_us(instr, cw, &rtpe_config.timeout_us); } static void cli_incoming_set_silenttimeout(str *instr, struct cli_writer *cw, const cli_handler_t *handler) { cli_incoming_set_gentimeout_us(instr, cw, &rtpe_config.silent_timeout_us); diff --git a/daemon/main.c b/daemon/main.c index 16d337ef8..1c5d28e38 100644 --- a/daemon/main.c +++ b/daemon/main.c @@ -673,6 +673,7 @@ static void options(int *argc, char ***argv, charp_ht templates) { g_autoptr(char) interfaces_config = NULL; g_autoptr(char) transcode_config = NULL; int silent_timeout = 0; + int timeout = 0; GOptionEntry e[] = { { "table", 't', 0, G_OPTION_ARG_INT, &rtpe_config.kernel_table, "Kernel table to use", "INT" }, @@ -703,7 +704,7 @@ static void options(int *argc, char ***argv, charp_ht templates) { { "tos", 'T', 0, G_OPTION_ARG_INT, &rtpe_config.default_tos, "Default TOS value to set on streams", "INT" }, { "control-tos",0 , 0, G_OPTION_ARG_INT, &rtpe_config.control_tos, "Default TOS value to set on control-ng", "INT" }, { "control-pmtu", 0,0, G_OPTION_ARG_STRING, &control_pmtu, "Path MTU discovery behaviour on UDP control sockets", "want|dont" }, - { "timeout", 'o', 0, G_OPTION_ARG_INT, &rtpe_config.timeout, "RTP timeout", "SECS" }, + { "timeout", 'o', 0, G_OPTION_ARG_INT, &timeout, "RTP timeout", "SECS" }, { "silent-timeout",'s',0,G_OPTION_ARG_INT, &silent_timeout, "RTP timeout for muted", "SECS" }, { "final-timeout",'a',0,G_OPTION_ARG_INT, &rtpe_config.final_timeout, "Call timeout", "SECS" }, { "offer-timeout",0,0, G_OPTION_ARG_INT, &rtpe_config.offer_timeout, "Timeout for incomplete one-sided calls", "SECS" }, @@ -1072,8 +1073,9 @@ static void options(int *argc, char ***argv, charp_ht templates) { if (rtpe_config.moh_max_duration <= 0) rtpe_config.moh_max_duration = 1800000; - if (rtpe_config.timeout <= 0) - rtpe_config.timeout = 60; + rtpe_config.timeout_us = timeout * 1000000LL; + if (rtpe_config.timeout_us <= 0) + rtpe_config.timeout_us = 60 * 1000000LL; rtpe_config.silent_timeout_us = silent_timeout * 1000000LL; if (rtpe_config.silent_timeout_us <= 0) diff --git a/include/main.h b/include/main.h index 96025736e..122b208bd 100644 --- a/include/main.h +++ b/include/main.h @@ -36,7 +36,6 @@ enum endpoint_learning { #define RTPE_CONFIG_INT_PARAMS \ X(kernel_table) \ X(max_sessions) \ - X(timeout) \ X(final_timeout) \ X(offer_timeout) \ X(moh_max_duration) \ @@ -106,6 +105,7 @@ enum endpoint_learning { #define RTPE_CONFIG_INT64_PARAMS \ X(bw_limit) \ X(silent_timeout_us) \ + X(timeout_us) \ #define RTPE_CONFIG_BOOL_PARAMS \ X(homer_rtcp_off) \