mirror of
https://github.com/nostar/urfd.git
synced 2026-11-08 04:19:39 +00:00
better loging of failed OpenStream
This commit is contained in:
1 parent
eb16567323
commit
7f81e70233
2 files changed
+15
-4
No files matched your search
@@ -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_ptr<CClient>client = nullptr;
|
||||
while ( (client = clients->FindNextClient(Callsign, Ip, EProtocol::m17, it)) != nullptr )
|
||||
{
|
||||
std::cout << "marking " << Callsign << " @ " << Ip << " Alive!" << std::endl;
|
||||
client->Alive();
|
||||
}
|
||||
g_Reflector.ReleaseClients();
|
||||
|
||||
+15
-1
@@ -156,11 +156,22 @@ std::shared_ptr<CPacketStream> CReflector::OpenStream(std::unique_ptr<CDvHeaderP
|
||||
{
|
||||
// check sid is not zero
|
||||
if ( 0U == DvHeader->GetStreamId() )
|
||||
{
|
||||
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<CPacketStream> CReflector::OpenStream(std::unique_ptr<CDvHeaderP
|
||||
char module = DvHeader->GetModule();
|
||||
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 ?
|
||||
|
||||
Reference in new issue
Block a user