diff --git a/reflector/M17Protocol.cpp b/reflector/M17Protocol.cpp index 29d6486..d8328d1 100644 --- a/reflector/M17Protocol.cpp +++ b/reflector/M17Protocol.cpp @@ -128,15 +128,12 @@ void CM17Protocol::Task(void) } else if ( IsValidKeepAlivePacket(Buffer, Callsign) ) { - std::cout << "M17 keepalive packet from " << Callsign << " at " << Ip << std::endl; - // find all clients with that callsign & ip and keep them alive CClients *clients = g_Reflector.GetClients(); auto it = clients->begin(); std::shared_ptrclient = nullptr; while ( (client = clients->FindNextClient(Callsign, Ip, EProtocol::m17, it)) != nullptr ) { - std::cout << "marking " << Callsign << " @ " << Ip << " Alive!" << std::endl; client->Alive(); } g_Reflector.ReleaseClients(); diff --git a/reflector/Reflector.cpp b/reflector/Reflector.cpp index 17fc240..71e0037 100644 --- a/reflector/Reflector.cpp +++ b/reflector/Reflector.cpp @@ -156,11 +156,22 @@ std::shared_ptr CReflector::OpenStream(std::unique_ptrGetStreamId() ) + { + std::cerr << "StreamId for client " << client->GetCallsign() << " is zero!" << std::endl; return nullptr; + } // check if client is valid candidate - if ( ! m_Clients.IsClient(client) || client->IsAMaster() ) + if ( ! m_Clients.IsClient(client) ) + { + std::cerr << "Client " << client->GetCallsign() << " is not a client!" << std::endl; return nullptr; + } + if ( client->IsAMaster() ) + { + std::cerr << "Client " << client->GetCallsign() << " is already a master!" << std::endl; + return nullptr; + } // check if no stream with same streamid already open // to prevent loops @@ -174,7 +185,10 @@ std::shared_ptr CReflector::OpenStream(std::unique_ptrGetModule(); auto stream = GetStream(module); if ( stream == nullptr ) + { + std::cerr << "Can't find module '" << module << "' for Client " << client->GetCallsign() << std::endl; return nullptr; + } stream->Lock(); // is it available ?