mirror of https://github.com/ShaYmez/xlxd.git
version 1.2.2
Corrected keep alive timeout issue when multi-module repeater linked
This commit is contained in:
parent
f66eef9a44
commit
5599420d92
|
@ -235,17 +235,42 @@ CClient *CClients::FindNextClient(int Protocol, int *index)
|
|||
return client;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// reporting
|
||||
|
||||
void CClients::WriteXml(std::ofstream &xmlFile)
|
||||
CClient *CClients::FindNextClient(const CIp &Ip, int Protocol, int *index)
|
||||
{
|
||||
xmlFile << "<CLIENTS>" << std::endl;
|
||||
for ( int i = 0; i < m_Clients.size(); i++ )
|
||||
CClient *client = NULL;
|
||||
|
||||
// find next client
|
||||
bool found = false;
|
||||
for ( int i = *index+1; (i < m_Clients.size()) && !found; i++ )
|
||||
{
|
||||
m_Clients[i]->WriteXml(xmlFile);
|
||||
if ( (m_Clients[i]->GetProtocol() == Protocol) &&
|
||||
(m_Clients[i]->GetIp() == Ip) )
|
||||
{
|
||||
found = true;
|
||||
client = m_Clients[i];
|
||||
*index = i;
|
||||
}
|
||||
}
|
||||
xmlFile << "</CLIENTS>" << std::endl;
|
||||
return client;
|
||||
}
|
||||
|
||||
CClient *CClients::FindNextClient(const CCallsign &Callsign, const CIp &Ip, int Protocol, int *index)
|
||||
{
|
||||
CClient *client = NULL;
|
||||
|
||||
// find next client
|
||||
bool found = false;
|
||||
for ( int i = *index+1; (i < m_Clients.size()) && !found; i++ )
|
||||
{
|
||||
if ( (m_Clients[i]->GetProtocol() == Protocol) &&
|
||||
(m_Clients[i]->GetIp() == Ip) &&
|
||||
m_Clients[i]->GetCallsign().HasSameCallsign(Callsign) )
|
||||
{
|
||||
found = true;
|
||||
client = m_Clients[i];
|
||||
*index = i;
|
||||
}
|
||||
}
|
||||
return client;
|
||||
}
|
||||
|
||||
|
|
|
@ -63,10 +63,9 @@ public:
|
|||
|
||||
// iterate on clients
|
||||
CClient *FindNextClient(int, int*);
|
||||
CClient *FindNextClient(const CIp &, int, int *);
|
||||
CClient *FindNextClient(const CCallsign &, const CIp &, int, int *);
|
||||
|
||||
// reporting
|
||||
void WriteXml(std::ofstream &);
|
||||
|
||||
protected:
|
||||
// data
|
||||
std::mutex m_Mutex;
|
||||
|
|
|
@ -158,11 +158,11 @@ void CDcsProtocol::Task(void)
|
|||
{
|
||||
//std::cout << "DCS keepalive packet from " << Callsign << " at " << Ip << std::endl;
|
||||
|
||||
// find client & keep it alive
|
||||
CClient *GetClient(const CCallsign &, const CIp &, char, int);
|
||||
|
||||
CClient *client = g_Reflector.GetClients()->FindClient(Ip, PROTOCOL_DCS);
|
||||
if ( client != NULL )
|
||||
// find all clients with that callsign & ip and keep them alive
|
||||
CClients *clients = g_Reflector.GetClients();
|
||||
int index = -1;
|
||||
CClient *client = NULL;
|
||||
while ( (client = clients->FindNextClient(Callsign, Ip, PROTOCOL_DCS, &index)) != NULL )
|
||||
{
|
||||
client->Alive();
|
||||
}
|
||||
|
|
|
@ -139,15 +139,15 @@ void CDextraProtocol::Task(void)
|
|||
}
|
||||
else if ( IsValidKeepAlivePacket(Buffer, &Callsign) )
|
||||
{
|
||||
//std::cout << "DExtra keepalive packet from " << Callsign << " at " << Ip << std::endl;
|
||||
//std::cout << "DExtra keepalive packet from " << Callsign << " at " << Ip << std::endl;
|
||||
|
||||
// find client & keep it alive
|
||||
CClient *GetClient(const CCallsign &, const CIp &, char, int);
|
||||
|
||||
CClient *client = g_Reflector.GetClients()->FindClient(Callsign, Ip, PROTOCOL_DEXTRA);
|
||||
if ( client != NULL )
|
||||
// find all clients with that callsign & ip and keep them alive
|
||||
CClients *clients = g_Reflector.GetClients();
|
||||
int index = -1;
|
||||
CClient *client = NULL;
|
||||
while ( (client = clients->FindNextClient(Callsign, Ip, PROTOCOL_DEXTRA, &index)) != NULL )
|
||||
{
|
||||
client->Alive();
|
||||
client->Alive();
|
||||
}
|
||||
g_Reflector.ReleaseClients();
|
||||
}
|
||||
|
|
|
@ -151,9 +151,11 @@ void CDplusProtocol::Task(void)
|
|||
{
|
||||
//std::cout << "DPlus keepalive packet from " << Ip << std::endl;
|
||||
|
||||
// find client & keep it alive
|
||||
CClient *client = g_Reflector.GetClients()->FindClient(Ip, PROTOCOL_DPLUS);
|
||||
if ( client != NULL )
|
||||
// find all clients with that callsign & ip and keep them alive
|
||||
CClients *clients = g_Reflector.GetClients();
|
||||
int index = -1;
|
||||
CClient *client = NULL;
|
||||
while ( (client = clients->FindNextClient(Ip, PROTOCOL_DPLUS, &index)) != NULL )
|
||||
{
|
||||
client->Alive();
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
|
||||
#define VERSION_MAJOR 1
|
||||
#define VERSION_MINOR 1
|
||||
#define VERSION_REVISION 1
|
||||
#define VERSION_REVISION 2
|
||||
|
||||
// global ------------------------------------------------------
|
||||
|
||||
|
|
Loading…
Reference in New Issue