Merge pull request #206 from f1rmb/connection_status_to_static_at_startup

This commit is contained in:
Jonathan Naylor 2022-01-25 22:49:48 +00:00 committed by GitHub
commit f9f1530dc9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 4 deletions

View File

@ -313,9 +313,11 @@ void CNXDNGateway::run()
hangTimer.start();
}
} else if (currentTG == 0U) {
// Don't pass reflector control data through to the MMDVM
if (::memcmp(buffer, "NXDND", 5U) == 0) {
// Find the static TG that this audio data belongs to
bool poll = false;
// We weren't really connected yet, but we got a reply from a poll, or some data
if ((::memcmp(buffer, "NXDND", 5U) == 0) || (poll = (::memcmp(buffer, "NXDNP", 5U) == 0))) {
// Find the static TG that this audio data/poll belongs to
for (std::vector<CStaticTG>::const_iterator it = staticTGs.cbegin(); it != staticTGs.cend(); ++it) {
if (CUDPSocket::match(addr, (*it).m_addr)) {
currentTG = (*it).m_tg;
@ -334,7 +336,7 @@ void CNXDNGateway::run()
bool grp = (buffer[9U] & 0x01U) == 0x01U;
if (grp && currentTG == dstTG)
if (grp && currentTG == dstTG && !poll)
localNetwork->write(buffer + 10U, len - 10U);
LogMessage("Switched to reflector %u due to network activity", currentTG);