pull/183/head
Jason D. McCormick 6 years ago
commit 56ec33a9b0

@ -41,13 +41,14 @@ class xReflector {
$handle = fopen($this->XMLFile, 'r');
$this->XMLContent = fread($handle, filesize($this->XMLFile));
fclose($handle);
# XLX alphanumeric naming...
$this->ServiceName = substr($this->XMLContent, strpos($this->XMLContent, "<XLX")+4, 3);
if (!is_numeric($this->ServiceName)) {
if (preg_match('/[^a-zA-Z0-9]/', $this->ServiceName) == 1) {
$this->ServiceName = null;
return false;
}
$this->ReflectorName = "XLX".$this->ServiceName;
$LinkedPeersName = "XLX".$this->ServiceName." linked peers";

@ -41,9 +41,10 @@ class xReflector {
$handle = fopen($this->XMLFile, 'r');
$this->XMLContent = fread($handle, filesize($this->XMLFile));
fclose($handle);
# XLX alphanumeric naming...
$this->ServiceName = substr($this->XMLContent, strpos($this->XMLContent, "<XLX")+4, 3);
if (!is_numeric($this->ServiceName)) {
if (preg_match('/[^a-zA-Z0-9]/', $this->ServiceName) == 1) {
$this->ServiceName = null;
return false;
}

@ -99,7 +99,7 @@ bool CCodecStream::Init(uint16 uiPort)
m_uiPort = uiPort;
// create our socket
ok = m_Socket.Open(uiPort);
ok = m_Socket.Open(CIp("0.0.0.0"), uiPort);
if ( ok )
{
// start thread;

@ -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();

@ -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;
}

@ -92,7 +92,7 @@ int CRawSocket::Receive(CBuffer *Buffer, CIp *Ip, int timeout)
if ( m_Socket != -1 )
{
// allocate buffer
Buffer->resize(UDP_BUFFER_LENMAX);
Buffer->resize(RAW_BUFFER_LENMAX);
// control socket
FD_ZERO(&FdSet);

@ -97,7 +97,7 @@ bool CTranscoder::Init(void)
m_Ip = g_Reflector.GetTranscoderIp();
// create our socket
ok = m_Socket.Open(TRANSCODER_PORT);
ok = m_Socket.Open(CIp("0.0.0.0"), TRANSCODER_PORT);
if ( ok )
{
// start thread;

@ -51,6 +51,11 @@ CUdpSocket::~CUdpSocket()
// open & close
bool CUdpSocket::Open(uint16 uiPort)
{
return Open(g_Reflector.GetListenIp(), uiPort);
}
bool CUdpSocket::Open(const CIp & listenIp, uint16 uiPort)
{
bool open = false;
@ -62,7 +67,7 @@ bool CUdpSocket::Open(uint16 uiPort)
::memset(&m_SocketAddr, 0, sizeof(struct sockaddr_in));
m_SocketAddr.sin_family = AF_INET;
m_SocketAddr.sin_port = htons(uiPort);
m_SocketAddr.sin_addr.s_addr = inet_addr(g_Reflector.GetListenIp());
m_SocketAddr.sin_addr.s_addr = inet_addr(listenIp);
if ( bind(m_Socket, (struct sockaddr *)&m_SocketAddr, sizeof(struct sockaddr_in)) == 0 )
{

@ -56,6 +56,7 @@ public:
// open & close
bool Open(uint16);
bool Open(const CIp &, uint16);
void Close(void);
int GetSocket(void) { return m_Socket; }

@ -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 ---------------------------------------------------

@ -28,3 +28,6 @@ install:
[ -f /xlxd/xlxd.interlink ] && \
cp ../config/xlxd.interlink /xlxd/xlxd.interlink.sample || \
cp ../config/xlxd.interlink /xlxd/xlxd.interlink
[ -f /xlxd/xlxd.terminal ] && \
cp ../config/xlxd.terminal /xlxd/xlxd.terminal.sample || \
cp ../config/xlxd.terminal /xlxd/xlxd.terminal

Loading…
Cancel
Save

Powered by TurnKey Linux.