From 4c85168a707a1c8f35b34dc7d72cbfa31fa0c639 Mon Sep 17 00:00:00 2001 From: Tobias Blomberg Date: Sat, 21 Nov 2020 13:01:13 +0100 Subject: [PATCH] ReflectorLogic UDP heartbeat interval adjustment It is now possible to adjust the ReflectorLogic UDP heartbeat interval using the UDP_HEARTBEAT_INTERVAL configuration variable. --- src/doc/man/svxlink.conf.5 | 16 +++++++++++----- src/svxlink/ChangeLog | 3 +++ src/svxlink/svxlink/ReflectorLogic.cpp | 8 ++++++-- src/svxlink/svxlink/ReflectorLogic.h | 3 ++- src/svxlink/svxlink/svxlink.conf.in | 1 + src/versions | 4 ++-- 6 files changed, 25 insertions(+), 10 deletions(-) diff --git a/src/doc/man/svxlink.conf.5 b/src/doc/man/svxlink.conf.5 index 18e29858..a231a99e 100644 --- a/src/doc/man/svxlink.conf.5 +++ b/src/doc/man/svxlink.conf.5 @@ -643,11 +643,6 @@ free-form JSON but the general structure should be kept so that SvxLink and the reflector server can fill in dynamic information about the node like signal strengths for receivers. Use the default node_info.json as a template. You can add more information rather freely but don't change the overall structure. -.P -It is also possible to set audio codec parameters using the same configuration -variables as documented for networked receivers and transmitters. For example, -to lighten the encoder CPU load for the Opus encoder, set OPUS_ENC_COMPLEXITY -to something lower than 9. .TP .B MUTE_FIRST_TX_LOC Mute the first transmission after selecting a talk group due to local activity. @@ -676,6 +671,17 @@ transmission to "open up" the local node. This is easy to forget. This configuration variable determines after how many seconds a manually added temporary talk group monitor will time out. Set to 0 to disable this feature. Default is 3600, one hour. +.TP +.B UDP_HEARTBEAT_INTERVAL +The number of seconds between UDP heartbeat messages sent to the reflector +server. This configuration variable can normally be left at the default value +but if you get frequent disconnects due to UDP heartbeat timeout it may help to +lower this value. Default: 15 +.P +It is also possible to set audio codec parameters using the same configuration +variables as documented for networked receivers and transmitters. For example, +to lighten the encoder CPU load for the Opus encoder, set OPUS_ENC_COMPLEXITY +to something lower than 9. . .SS QSO Recorder Section . diff --git a/src/svxlink/ChangeLog b/src/svxlink/ChangeLog index 331c41e2..f5bd46b8 100644 --- a/src/svxlink/ChangeLog +++ b/src/svxlink/ChangeLog @@ -65,6 +65,9 @@ * Added debug mode for the CTCSS detector. Enable by setting CTCSS_DEBUG to 1 in a receiver configuration section. +* ReflectorLogic: Now possible to adjust the UDP heartbeat interval using the + UDP_HEARTBEAT_INTERVAL configuration variable. + 1.7.0 -- 01 Sep 2019 diff --git a/src/svxlink/svxlink/ReflectorLogic.cpp b/src/svxlink/svxlink/ReflectorLogic.cpp index db64c78e..fb03ff9d 100644 --- a/src/svxlink/svxlink/ReflectorLogic.cpp +++ b/src/svxlink/svxlink/ReflectorLogic.cpp @@ -126,6 +126,7 @@ ReflectorLogic::ReflectorLogic(Async::Config& cfg, const std::string& name) m_next_udp_tx_seq(0), m_next_udp_rx_seq(0), m_heartbeat_timer(1000, Timer::TYPE_PERIODIC, false), m_dec(0), m_flush_timeout_timer(3000, Timer::TYPE_ONESHOT, false), + m_udp_heartbeat_tx_cnt_reset(DEFAULT_UDP_HEARTBEAT_TX_CNT_RESET), m_udp_heartbeat_tx_cnt(0), m_udp_heartbeat_rx_cnt(0), m_tcp_heartbeat_tx_cnt(0), m_tcp_heartbeat_rx_cnt(0), m_con_state(STATE_DISCONNECTED), m_enc(0), m_default_tg(0), @@ -362,6 +363,9 @@ bool ReflectorLogic::initialize(void) m_node_info["sw"] = "SvxLink"; m_node_info["swVer"] = SVXLINK_VERSION; + cfg().getValue(name(), "UDP_HEARTBEAT_INTERVAL", + m_udp_heartbeat_tx_cnt_reset); + if (!LogicBase::initialize()) { return false; @@ -648,7 +652,7 @@ void ReflectorLogic::onConnected(void) cout << name() << ": Connection established to " << m_con->remoteHost() << ":" << m_con->remotePort() << endl; sendMsg(MsgProtoVer()); - m_udp_heartbeat_tx_cnt = UDP_HEARTBEAT_TX_CNT_RESET; + m_udp_heartbeat_tx_cnt = m_udp_heartbeat_tx_cnt_reset; m_udp_heartbeat_rx_cnt = UDP_HEARTBEAT_RX_CNT_RESET; m_tcp_heartbeat_tx_cnt = TCP_HEARTBEAT_TX_CNT_RESET; m_tcp_heartbeat_rx_cnt = TCP_HEARTBEAT_RX_CNT_RESET; @@ -1283,7 +1287,7 @@ void ReflectorLogic::sendUdpMsg(const ReflectorUdpMsg& msg) return; } - m_udp_heartbeat_tx_cnt = UDP_HEARTBEAT_TX_CNT_RESET; + m_udp_heartbeat_tx_cnt = m_udp_heartbeat_tx_cnt_reset; if (m_udp_sock == 0) { diff --git a/src/svxlink/svxlink/ReflectorLogic.h b/src/svxlink/svxlink/ReflectorLogic.h index f16a31cc..c5214013 100644 --- a/src/svxlink/svxlink/ReflectorLogic.h +++ b/src/svxlink/svxlink/ReflectorLogic.h @@ -204,7 +204,7 @@ class ReflectorLogic : public LogicBase typedef Async::TcpClient FramedTcpClient; typedef std::set MonitorTgsSet; - static const unsigned UDP_HEARTBEAT_TX_CNT_RESET = 15; + static const unsigned DEFAULT_UDP_HEARTBEAT_TX_CNT_RESET = 15; static const unsigned UDP_HEARTBEAT_RX_CNT_RESET = 60; static const unsigned TCP_HEARTBEAT_TX_CNT_RESET = 10; static const unsigned TCP_HEARTBEAT_RX_CNT_RESET = 15; @@ -227,6 +227,7 @@ class ReflectorLogic : public LogicBase Async::Timer m_heartbeat_timer; Async::AudioDecoder* m_dec; Async::Timer m_flush_timeout_timer; + unsigned m_udp_heartbeat_tx_cnt_reset; unsigned m_udp_heartbeat_tx_cnt; unsigned m_udp_heartbeat_rx_cnt; unsigned m_tcp_heartbeat_tx_cnt; diff --git a/src/svxlink/svxlink/svxlink.conf.in b/src/svxlink/svxlink/svxlink.conf.in index 9ac73867..e3d89b12 100644 --- a/src/svxlink/svxlink/svxlink.conf.in +++ b/src/svxlink/svxlink/svxlink.conf.in @@ -98,6 +98,7 @@ EVENT_HANDLER=@SVX_SHARE_INSTALL_DIR@/events.tcl #MUTE_FIRST_TX_LOC=1 #MUTE_FIRST_TX_REM=1 #TMP_MONITOR_TIMEOUT=3600 +#UDP_HEARTBEAT_INTERVAL=15 [LinkToR4] CONNECT_LOGICS=RepeaterLogic:94:SK3AB,SimplexLogic:92:SK3CD diff --git a/src/versions b/src/versions index e2d4af58..4190527f 100644 --- a/src/versions +++ b/src/versions @@ -1,4 +1,4 @@ - # Project release version +# Project release version PROJECT=master # Version for the Qtel application @@ -11,7 +11,7 @@ LIBECHOLIB=1.3.3 LIBASYNC=1.6.0.99.10 # SvxLink versions -SVXLINK=1.7.99.24 +SVXLINK=1.7.99.25 MODULE_HELP=1.0.0 MODULE_PARROT=1.1.1 MODULE_ECHO_LINK=1.5.99.0