From 357dd54179284b7140b9866dfbe8f8ab23c38191 Mon Sep 17 00:00:00 2001 From: Tom Early Date: Fri, 14 Aug 2020 09:10:26 -0700 Subject: [PATCH] don't patch callsign in CG3Protocol::Initialize --- src/cg3protocol.cpp | 17 ++++++++--------- src/cg3protocol.h | 4 ++-- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/cg3protocol.cpp b/src/cg3protocol.cpp index 389d158..225e81d 100644 --- a/src/cg3protocol.cpp +++ b/src/cg3protocol.cpp @@ -49,7 +49,7 @@ bool CG3Protocol::Initialize(const char */*type*/, const uint16 /*port*/, const keep_running = true; // update the reflector callsign - m_ReflectorCallsign.PatchCallsign(0, (const uint8 *)"XLX", 3); + //m_ReflectorCallsign.PatchCallsign(0, (const uint8 *)"XLX", 3); // create our sockets CIp ip(AF_INET, G3_DV_PORT, g_Reflector.GetListenIPv4()); @@ -166,7 +166,7 @@ void CG3Protocol::PresenceTask(void) Owner.SetCallsign(&Buffer.data()[16], 8); Terminal.SetCallsign(&Buffer.data()[24], 8); - std::cout << "Presence from " << Ip << " as " << Callsign << " on terminal " << Terminal << std::endl; + std::cout << "Presence from owner " << Owner << " on " << Ip << " as " << Callsign << " on terminal " << Terminal << std::endl; // accept Buffer.data()[2] = 0x80; // response @@ -200,13 +200,11 @@ void CG3Protocol::PresenceTask(void) // do we already have a client with the same call (IP changed)? while ( (extant = clients->FindNextClient(PROTOCOL_G3, it)) != nullptr ) { + if (extant->GetCallsign().HasSameCallsign(Terminal)) { - if (extant->GetCallsign().HasSameCallsign(Terminal)) - { - //delete old client - clients->RemoveClient(extant); - break; - } + //delete old client + clients->RemoveClient(extant); + break; } } @@ -690,7 +688,8 @@ char *CG3Protocol::TrimWhiteSpaces(char *str) if (*str == 0) return str; end = str + strlen(str) - 1; - while ((end > str) && ((*end == ' ') || (*end == '\t') || (*end == '\r'))) end --; + while ((end > str) && ((*end == ' ') || (*end == '\t') || (*end == '\r'))) + end--; *(end + 1) = 0; return str; } diff --git a/src/cg3protocol.h b/src/cg3protocol.h index bb22bf2..97ff5ea 100644 --- a/src/cg3protocol.h +++ b/src/cg3protocol.h @@ -40,10 +40,10 @@ // // There are 3 steps in handling an incoming connection // -// 1 - Notification of terminal call on port UDP 12346 +// 1 - Notification of terminal call on port UDP 12346, Presence port, aCUdpSocket. // - Call will be rejected if in blacklisted // -// 2 - Destination request on port UDP 12345 +// 2 - Destination request on port UDP 12345, Config port, a CUdpMsgSocket. // - Calls to specific callsigns will be accepted for a default module // - Repeater calls will be accepted for local modules // - All other calls are rejected