diff --git a/dashboard/pgs/class.reflector.php b/dashboard/pgs/class.reflector.php index 6ec8a6e..099599c 100755 --- a/dashboard/pgs/class.reflector.php +++ b/dashboard/pgs/class.reflector.php @@ -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, "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"; diff --git a/dashboard2/pgs/class.reflector.php b/dashboard2/pgs/class.reflector.php index d6505f7..2d29483 100644 --- a/dashboard2/pgs/class.reflector.php +++ b/dashboard2/pgs/class.reflector.php @@ -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, "ServiceName)) { + if (preg_match('/[^a-zA-Z0-9]/', $this->ServiceName) == 1) { $this->ServiceName = null; return false; } diff --git a/src/ccodecstream.cpp b/src/ccodecstream.cpp index 7d8e0c8..10d9a2b 100644 --- a/src/ccodecstream.cpp +++ b/src/ccodecstream.cpp @@ -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; diff --git a/src/cg3protocol.cpp b/src/cg3protocol.cpp old mode 100644 new mode 100755 index 053da9d..9f85420 --- a/src/cg3protocol.cpp +++ b/src/cg3protocol.cpp @@ -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(); diff --git a/src/cprotocol.cpp b/src/cprotocol.cpp old mode 100644 new mode 100755 index 12661eb..6054971 --- a/src/cprotocol.cpp +++ b/src/cprotocol.cpp @@ -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; } + diff --git a/src/crawsocket.cpp b/src/crawsocket.cpp index a30908d..119dbb1 100644 --- a/src/crawsocket.cpp +++ b/src/crawsocket.cpp @@ -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); diff --git a/src/ctranscoder.cpp b/src/ctranscoder.cpp index 6b810c9..36faa8a 100644 --- a/src/ctranscoder.cpp +++ b/src/ctranscoder.cpp @@ -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; diff --git a/src/cudpsocket.cpp b/src/cudpsocket.cpp index 5caa074..b528ffa 100644 --- a/src/cudpsocket.cpp +++ b/src/cudpsocket.cpp @@ -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 ) { diff --git a/src/cudpsocket.h b/src/cudpsocket.h index e91ed80..bb28fc1 100644 --- a/src/cudpsocket.h +++ b/src/cudpsocket.h @@ -56,6 +56,7 @@ public: // open & close bool Open(uint16); + bool Open(const CIp &, uint16); void Close(void); int GetSocket(void) { return m_Socket; } diff --git a/src/main.h b/src/main.h old mode 100644 new mode 100755 index 03c3af1..7127e39 --- a/src/main.h +++ b/src/main.h @@ -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 --------------------------------------------------- diff --git a/src/makefile b/src/makefile index de1e0db..2d7b587 100644 --- a/src/makefile +++ b/src/makefile @@ -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