fake the xml file for now...

unstable
Tom Early 4 years ago
parent cf448cd496
commit d26f732edd

@ -61,7 +61,7 @@
// version ----------------------------------------------------- // version -----------------------------------------------------
#define VERSION_MAJOR 1 #define VERSION_MAJOR 0
#define VERSION_MINOR 0 #define VERSION_MINOR 0
#define VERSION_REVISION 0 #define VERSION_REVISION 0
@ -180,13 +180,12 @@ enum class EProtocol { any, none, dextra, dplus, dcs, xlx, urf, dmrplus, dmrmmdv
#endif #endif
// system paths ------------------------------------------------- // system paths -------------------------------------------------
//#define XML_PATH "/var/log/urfd.xml" //#define XML_PATH "/var/log/xlxd.xml"
#define XML_PATH "./urfd.xml" #define XML_PATH "./urfd.xml"
#define WHITELIST_PATH "/usr/local/etc/urfd.whitelist" #define WHITELIST_PATH "/usr/local/etc/urfd.whitelist"
#define BLACKLIST_PATH "/usr/local/etc/urfd.blacklist" #define BLACKLIST_PATH "/usr/local/etc/urfd.blacklist"
#define INTERLINKLIST_PATH "/usr/local/etc/urfd.interlink" #define INTERLINKLIST_PATH "/usr/local/etc/urfd.interlink"
#define TERMINALOPTIONS_PATH "/usr/local/etc/urfd.terminal" #define TERMINALOPTIONS_PATH "/usr/local/etc/urfd.terminal"
#define DEBUGDUMP_PATH "/var/log/urfd.debug"
#define PIDFILE_PATH "/var/run/urfd.pid" #define PIDFILE_PATH "/var/run/urfd.pid"

@ -21,11 +21,6 @@
#include "Packet.h" #include "Packet.h"
#include "Client.h" #include "Client.h"
////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////
// CPacketQueue
class CClient; class CClient;
class CPacketQueue class CPacketQueue
@ -35,13 +30,33 @@ public:
virtual ~CPacketQueue() {} virtual ~CPacketQueue() {}
// lock // lock
void Lock() { m_Mutex.lock(); } void Lock()
void Unlock() { m_Mutex.unlock(); } {
m_Mutex.lock();
}
void Unlock()
{
m_Mutex.unlock();
}
// pass thru // pass thru
std::unique_ptr<CPacket> pop() { auto pack = std::move(queue.front()); queue.pop(); return std::move(pack); } std::unique_ptr<CPacket> pop()
bool empty() const { return queue.empty(); } {
void push(std::unique_ptr<CPacket> &packet) { queue.push(std::move(packet)); } auto pack = std::move(queue.front());
queue.pop();
return std::move(pack);
}
bool empty() const
{
return queue.empty();
}
void push(std::unique_ptr<CPacket> &packet)
{
queue.push(std::move(packet));
}
protected: protected:
// status // status
@ -50,6 +65,6 @@ protected:
std::mutex m_Mutex; std::mutex m_Mutex;
// owner // owner
CClient *m_Client; CClient *m_Client;
std::queue<std::unique_ptr<CPacket>> queue; std::queue<std::unique_ptr<CPacket>> queue;
}; };

@ -538,8 +538,11 @@ void CReflector::WriteXmlFile(std::ofstream &xmlFile)
::sprintf(sz, "%d.%d.%d", VERSION_MAJOR, VERSION_MINOR, VERSION_REVISION); ::sprintf(sz, "%d.%d.%d", VERSION_MAJOR, VERSION_MINOR, VERSION_REVISION);
xmlFile << "<Version>" << sz << "</Version>" << std::endl; xmlFile << "<Version>" << sz << "</Version>" << std::endl;
CCallsign cs = m_Callsign;
cs.PatchCallsign(0, "XLX", 3);
// linked peers // linked peers
xmlFile << "<" << m_Callsign << "linked peers>" << std::endl; xmlFile << "<" << cs << "linked peers>" << std::endl;
// lock // lock
CPeers *peers = GetPeers(); CPeers *peers = GetPeers();
// iterate on peers // iterate on peers
@ -549,10 +552,10 @@ void CReflector::WriteXmlFile(std::ofstream &xmlFile)
} }
// unlock // unlock
ReleasePeers(); ReleasePeers();
xmlFile << "</" << m_Callsign << "linked peers>" << std::endl; xmlFile << "</" << cs << "linked peers>" << std::endl;
// linked nodes // linked nodes
xmlFile << "<" << m_Callsign << "linked nodes>" << std::endl; xmlFile << "<" << cs << "linked nodes>" << std::endl;
// lock // lock
CClients *clients = GetClients(); CClients *clients = GetClients();
// iterate on clients // iterate on clients
@ -565,10 +568,10 @@ void CReflector::WriteXmlFile(std::ofstream &xmlFile)
} }
// unlock // unlock
ReleaseClients(); ReleaseClients();
xmlFile << "</" << m_Callsign << "linked nodes>" << std::endl; xmlFile << "</" << cs << "linked nodes>" << std::endl;
// last heard users // last heard users
xmlFile << "<" << m_Callsign << "heard users>" << std::endl; xmlFile << "<" << cs << "heard users>" << std::endl;
// lock // lock
CUsers *users = GetUsers(); CUsers *users = GetUsers();
// iterate on users // iterate on users
@ -578,7 +581,7 @@ void CReflector::WriteXmlFile(std::ofstream &xmlFile)
} }
// unlock // unlock
ReleaseUsers(); ReleaseUsers();
xmlFile << "</" << m_Callsign << "heard users>" << std::endl; xmlFile << "</" << cs << "heard users>" << std::endl;
} }

Loading…
Cancel
Save

Powered by TurnKey Linux.