diff --git a/Conf.cpp b/Conf.cpp index 14ea047..c92a9e0 100644 --- a/Conf.cpp +++ b/Conf.cpp @@ -176,7 +176,7 @@ m_dmrNetworkLocal(0U), m_dmrNetworkPassword(), m_dmrNetworkOptions(), m_dmrNetworkDebug(false), -m_dmrNetworkJitter(300U), +m_dmrNetworkJitter(360U), m_dmrNetworkSlot1(true), m_dmrNetworkSlot2(true), m_dmrNetworkModeHang(3U), diff --git a/DMRNetwork.cpp b/DMRNetwork.cpp index 15bf3bc..86bc335 100644 --- a/DMRNetwork.cpp +++ b/DMRNetwork.cpp @@ -26,6 +26,7 @@ #include #include #include +#include const unsigned int BUFFER_LENGTH = 500U; @@ -33,6 +34,7 @@ const unsigned int HOMEBREW_DATA_PACKET_LENGTH = 55U; CDMRNetwork::CDMRNetwork(const std::string& address, unsigned int port, unsigned int local, unsigned int id, const std::string& password, bool duplex, const char* version, bool debug, bool slot1, bool slot2, HW_TYPE hwType) : +m_addressStr(address), m_address(), m_port(port), m_id(NULL), @@ -122,6 +124,9 @@ bool CDMRNetwork::open() { LogMessage("DMR, Opening DMR Network"); + if (m_address.s_addr == INADDR_NONE) + m_address = CUDPSocket::lookup(m_addressStr); + m_status = WAITING_CONNECT; m_timeoutTimer.stop(); m_retryTimer.start(); diff --git a/DMRNetwork.h b/DMRNetwork.h index d1d12e4..9dbb812 100644 --- a/DMRNetwork.h +++ b/DMRNetwork.h @@ -57,6 +57,7 @@ public: void close(); private: + std::string m_addressStr; in_addr m_address; unsigned int m_port; uint8_t* m_id; diff --git a/DStarNetwork.cpp b/DStarNetwork.cpp index 443fcac..ebf971f 100644 --- a/DStarNetwork.cpp +++ b/DStarNetwork.cpp @@ -26,6 +26,7 @@ #include #include #include +#include const unsigned int BUFFER_LENGTH = 100U; diff --git a/MMDVMHost.cpp b/MMDVMHost.cpp index 56df2dc..c9868c3 100644 --- a/MMDVMHost.cpp +++ b/MMDVMHost.cpp @@ -48,6 +48,8 @@ #include #include +#include + #if !defined(_WIN32) && !defined(_WIN64) #include #include @@ -210,7 +212,7 @@ int CMMDVMHost::run() ::close(STDOUT_FILENO); ::close(STDERR_FILENO); -#if !defined(HD44780) && !defined(OLED) +#if !defined(HD44780) && !defined(OLED) && !defined(_OPENWRT) // If we are currently root... if (getuid() == 0) { struct passwd* user = ::getpwnam("mmdvm"); @@ -241,7 +243,7 @@ int CMMDVMHost::run() } } #else - ::fprintf(stderr, "Dropping root permissions in daemon mode is disabled with HD44780 display\n"); + ::fprintf(stderr, "Dropping root permissions in daemon mode is disabled.\n"); } #endif #endif diff --git a/P25NID.cpp b/P25NID.cpp index bc41f0b..0c50dbf 100644 --- a/P25NID.cpp +++ b/P25NID.cpp @@ -34,7 +34,8 @@ m_ldu1(NULL), m_ldu2(NULL), m_termlc(NULL), m_term(NULL), -m_pdu(NULL) +m_pdu(NULL), +m_tsdu(NULL) { CBCH bch; @@ -97,6 +98,7 @@ CP25NID::~CP25NID() delete[] m_term; delete[] m_tsdu; delete[] m_pdu; + delete[] m_tsdu; } bool CP25NID::decode(const unsigned char* data) diff --git a/StopWatch.cpp b/StopWatch.cpp index 77d539d..2f15645 100644 --- a/StopWatch.cpp +++ b/StopWatch.cpp @@ -52,6 +52,7 @@ unsigned int CStopWatch::elapsed() #else #include +#include CStopWatch::CStopWatch() : m_start() @@ -64,21 +65,17 @@ CStopWatch::~CStopWatch() unsigned long CStopWatch::start() { - ::gettimeofday(&m_start, NULL); + ::clock_gettime(CLOCK_MONOTONIC, &m_start); - return m_start.tv_usec; + return m_start.tv_sec * 1000UL + m_start.tv_nsec / 1000000UL; } unsigned int CStopWatch::elapsed() { - struct timeval now; - ::gettimeofday(&now, NULL); - - unsigned int elapsed = (now.tv_sec - m_start.tv_sec) * 1000U; - elapsed += now.tv_usec / 1000U; - elapsed -= m_start.tv_usec / 1000U; - - return elapsed; + struct timespec now; + ::clock_gettime(CLOCK_MONOTONIC, &now); + int offset = ((now.tv_sec - m_start.tv_sec) * 1000000000UL + now.tv_nsec - m_start.tv_nsec ) / 1000000UL; + return (unsigned int)offset; } #endif diff --git a/StopWatch.h b/StopWatch.h index 811047e..a1e2bf8 100644 --- a/StopWatch.h +++ b/StopWatch.h @@ -39,7 +39,7 @@ private: LARGE_INTEGER m_frequency; LARGE_INTEGER m_start; #else - struct timeval m_start; + struct timespec m_start; #endif };