diff --git a/reflector/NXDNProtocol.cpp b/reflector/NXDNProtocol.cpp index b944ca8..e26135c 100644 --- a/reflector/NXDNProtocol.cpp +++ b/reflector/NXDNProtocol.cpp @@ -148,6 +148,20 @@ void CNXDNProtocol::Task(void) g_Reflector.ReleaseClients(); } } + else if ( IsValidDisconnectPacket(Buffer) ) + { + std::cout << "NXDN disconnect packet from " << Ip << std::endl; + + // find client + CClients *clients = g_Reflector.GetClients(); + std::shared_ptrclient = clients->FindClient(Ip, EProtocol::nxdn); + if ( client != nullptr ) + { + // remove it + clients->RemoveClient(client); + } + g_Reflector.ReleaseClients(); + } else { #ifdef DEBUG @@ -347,7 +361,7 @@ bool CNXDNProtocol::IsValidConnectPacket(const CBuffer &Buffer, CCallsign *calls return valid; } -bool CNXDNProtocol::IsValidDisconnectPacket(const CBuffer &Buffer, CCallsign *callsign) +bool CNXDNProtocol::IsValidDisconnectPacket(const CBuffer &Buffer) { uint8_t tag[] = { 'N','X','D','N','U' }; diff --git a/reflector/NXDNProtocol.h b/reflector/NXDNProtocol.h index 50c1542..66c6896 100644 --- a/reflector/NXDNProtocol.h +++ b/reflector/NXDNProtocol.h @@ -68,7 +68,7 @@ protected: // DV packet decoding helpers bool IsValidConnectPacket(const CBuffer &, CCallsign *); - bool IsValidDisconnectPacket(const CBuffer &, CCallsign *); + bool IsValidDisconnectPacket(const CBuffer &); bool IsValidDvHeaderPacket(const CIp &, const CBuffer &, std::unique_ptr &); bool IsValidDvFramePacket(const CIp &, const CBuffer &, std::unique_ptr &, std::array, 4> &); bool IsValidDvLastFramePacket(const CIp &, const CBuffer &); diff --git a/reflector/P25Protocol.cpp b/reflector/P25Protocol.cpp index dc59a18..9cbe14a 100644 --- a/reflector/P25Protocol.cpp +++ b/reflector/P25Protocol.cpp @@ -142,7 +142,7 @@ void CP25Protocol::Task(void) // find client CClients *clients = g_Reflector.GetClients(); - std::shared_ptrclient = clients->FindClient(Ip, EProtocol::m17); + std::shared_ptrclient = clients->FindClient(Ip, EProtocol::p25); if ( client != nullptr ) { // remove it diff --git a/reflector/YSFProtocol.cpp b/reflector/YSFProtocol.cpp index eec9bc6..462f691 100644 --- a/reflector/YSFProtocol.cpp +++ b/reflector/YSFProtocol.cpp @@ -171,6 +171,23 @@ void CYsfProtocol::Task(void) g_Reflector.ReleaseClients(); } } + else if ( IsValidDisconnectPacket(Buffer) ) + { + std::cout << "YSF disconnect packet from " << Ip << std::endl; + + // find client + CClients *clients = g_Reflector.GetClients(); + std::shared_ptrclient = clients->FindClient(Ip, EProtocol::ysf); + if ( client != nullptr ) + { + // remove it + clients->RemoveClient(client); + // and acknowledge the disconnect + //EncodeDisconnectPacket(&Buffer); + //Send(Buffer, Ip); + } + g_Reflector.ReleaseClients(); + } else if ( IsValidwirexPacket(Buffer, &Fich, &Callsign, &iWiresxCmd, &iWiresxArg) ) { // std::cout << "Got a WiresX command from " << Callsign << " at " << Ip << " cmd=" <