From 175cb15254a7c02dadfa22622742a9edc74188eb Mon Sep 17 00:00:00 2001 From: Audric Date: Wed, 8 Apr 2026 17:33:04 +0200 Subject: [PATCH] Ignore duplicate hello on inbound trunk connection handleMsgTrunkHello was called for hellos arriving on both outbound and inbound connections. Inbound hellos are already handled by acceptInboundConnection, so a second one arriving via onFrameReceived (e.g. from TcpPrioClient background reconnect) is a duplicate. Silently ignore it instead of printing a misleading double hello log. --- src/svxlink/reflector/TrunkLink.cpp | 17 +++++++++++++++-- src/svxlink/reflector/TrunkLink.h | 2 +- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/svxlink/reflector/TrunkLink.cpp b/src/svxlink/reflector/TrunkLink.cpp index 1755994..a2ae8d0 100644 --- a/src/svxlink/reflector/TrunkLink.cpp +++ b/src/svxlink/reflector/TrunkLink.cpp @@ -590,7 +590,7 @@ void TrunkLink::onFrameReceived(FramedTcpConnection* con, handleMsgTrunkHeartbeat(); break; case MsgTrunkHello::TYPE: - handleMsgTrunkHello(ss); + handleMsgTrunkHello(ss, is_inbound); break; case MsgTrunkTalkerStart::TYPE: handleMsgTrunkTalkerStart(ss); @@ -618,8 +618,21 @@ void TrunkLink::handleMsgTrunkHeartbeat(void) } /* TrunkLink::handleMsgTrunkHeartbeat */ -void TrunkLink::handleMsgTrunkHello(std::istream& is) +void TrunkLink::handleMsgTrunkHello(std::istream& is, bool is_inbound) { + // Inbound hellos are already handled by acceptInboundConnection. + // A duplicate arriving here means the peer re-sent (e.g. TcpPrioClient + // background reconnect) — ignore it silently. + if (is_inbound) + { + if (m_debug) + { + cout << m_section << " [DEBUG]: ignoring duplicate hello on inbound" + << endl; + } + return; + } + // Hello on outbound = peer's reply to our outbound hello MsgTrunkHello msg; if (!msg.unpack(is)) diff --git a/src/svxlink/reflector/TrunkLink.h b/src/svxlink/reflector/TrunkLink.h index 5df4b4b..520f5db 100644 --- a/src/svxlink/reflector/TrunkLink.h +++ b/src/svxlink/reflector/TrunkLink.h @@ -187,7 +187,7 @@ class TrunkLink : public sigc::trackable void onFrameReceived(Async::FramedTcpConnection* con, std::vector& data); - void handleMsgTrunkHello(std::istream& is); + void handleMsgTrunkHello(std::istream& is, bool is_inbound); void handleMsgTrunkTalkerStart(std::istream& is); void handleMsgTrunkTalkerStop(std::istream& is); void handleMsgTrunkAudio(std::istream& is);