1
0
mirror of https://github.com/ShaYmez/xlxd.git synced 2024-12-22 09:31:14 -05:00

xlxd 2.4.1

Corrected bug : last packets of a stream are sent back to sender
This commit is contained in:
LX3JL 2021-01-05 10:36:36 +01:00
parent af900106c5
commit cb989fd8de
3 changed files with 14 additions and 7 deletions

4
src/cg3protocol.cpp Normal file → Executable file
View File

@ -69,6 +69,7 @@ bool CG3Protocol::Init(void)
std::cout << "Error opening socket on port UDP" << G3_CONFIG_PORT << " on ip " << g_Reflector.GetListenIp() << std::endl;
}
#ifndef DEBUG_NO_G3_ICMP_SOCKET
ok &= m_IcmpRawSocket.Open(IPPROTO_ICMP);
if ( !ok )
{
@ -82,7 +83,8 @@ bool CG3Protocol::Init(void)
m_pPresenceThread = new std::thread(ConfigThread, this);
m_pPresenceThread = new std::thread(IcmpThread, this);
}
#endif
// update time
m_LastKeepaliveTime.Now();

14
src/cprotocol.cpp Normal file → Executable file
View File

@ -140,7 +140,7 @@ void CProtocol::OnDvFramePacketIn(CDvFramePacket *Frame, const CIp *Ip)
CPacketStream *stream = GetStream(Frame->GetStreamId(), Ip);
if ( stream == NULL )
{
std::cout << "Deleting oprhaned Frame Packet with StreamId " << Frame->GetStreamId() << " from " << *Ip << std::endl;
// std::cout << "Deleting oprhaned Last Frame Packet with StreamId " << Frame->GetStreamId() << " from " << *Ip << std::endl;
delete Frame;
}
else
@ -159,7 +159,7 @@ void CProtocol::OnDvLastFramePacketIn(CDvLastFramePacket *Frame, const CIp *Ip)
CPacketStream *stream = GetStream(Frame->GetStreamId(), Ip);
if ( stream == NULL )
{
std::cout << "Deleting oprhaned Last Frame Packet with StreamId " << Frame->GetStreamId() << " from " << *Ip << std::endl;
// std::cout << "Deleting oprhaned Last Frame Packet with StreamId " << Frame->GetStreamId() << " from " << *Ip << std::endl;
delete Frame;
}
else
@ -168,9 +168,12 @@ void CProtocol::OnDvLastFramePacketIn(CDvLastFramePacket *Frame, const CIp *Ip)
stream->Lock();
stream->Push(Frame);
stream->Unlock();
// and close the stream
g_Reflector.CloseStream(stream);
// and don't close the stream yet but rely on CheckStreamsTimeout
// mechanism, so the stream will be closed after the queues have
// been sinked out. This avoid last packets to be send back
// to transmitting client (master)
// g_Reflector.CloseStream(stream);
}
}
@ -266,3 +269,4 @@ uint32 CProtocol::ModuleToDmrDestId(char m) const
{
return (uint32)(m - 'A')+1;
}

3
src/main.h Normal file → Executable file
View File

@ -49,7 +49,7 @@
#define VERSION_MAJOR 2
#define VERSION_MINOR 4
#define VERSION_REVISION 0
#define VERSION_REVISION 1
// global ------------------------------------------------------
@ -60,6 +60,7 @@
//#define DEBUG_NO_ERROR_ON_XML_OPEN_FAIL
//#define DEBUG_DUMPFILE
//#define DEBUG_NO_G3_ICMP_SOCKET
// reflector ---------------------------------------------------