still some problems with CPacketQueue locking

pull/1/head
Tom Early 3 years ago
parent 22ca376852
commit 939773f54b

@ -28,7 +28,6 @@
CCallsignList::CCallsignList()
{
m_Filename = nullptr;
memset(&m_LastModTime, 0, sizeof(time_t));
}

@ -18,9 +18,9 @@
#include <string.h>
#include "CodecStream.h"
#include "DVFramePacket.h"
#include "Reflector.h"
#include "PacketStream.h"
#include "CodecStream.h"
////////////////////////////////////////////////////////////////////////////////////////
// constructor
@ -78,6 +78,9 @@ void CCodecStream::ReportStats()
bool CCodecStream::InitCodecStream(char module)
{
#ifdef DEBUG
std::cout << "Initializing codec stream for module '" << module << "'" << std::endl;
#endif
m_TCWriter.SetUp(REF2TC);
std::string name(TC2REF);
name.append(1, module);

@ -571,7 +571,7 @@ bool CConfigure::ReadData(const std::string &path)
}
else
{
data[g_Keys.ip.ipv4bind] = nullptr;
data[g_Keys.ip.ipv6bind] = nullptr;
data[g_Keys.ip.ipv6address] = nullptr;
}

@ -20,11 +20,6 @@
#include "Timer.h"
#include "Global.h"
////////////////////////////////////////////////////////////////////////////////////////
CGateKeeper g_GateKeeper;
////////////////////////////////////////////////////////////////////////////////////////
// constructor

@ -70,7 +70,7 @@ void CLookupYsf::UpdateContent(std::stringstream &ss, Eaction action)
}
}
if (Eaction::normal == action)
std::cout << "DMR Id database size now is " << m_map.size() << std::endl;
std::cout << "YSF frequency database size now is " << m_map.size() << std::endl;
}
void CLookupYsf::FindFrequencies(const CCallsign &cs, uint32_t &txfreq, uint32_t &rxfreq)

@ -46,6 +46,7 @@ int main(int argc, char *argv[])
if (g_Conf.ReadData(argv[1]))
return EXIT_FAILURE;
std::cout << "IPv4 binding address is '" << g_Conf.GetString(g_Keys.ip.ipv4bind) << "'" << std::endl;
// remove pidfile
const std::string pidpath(g_Conf.GetString(g_Keys.files.pid));
const std::string callsign(g_Conf.GetString(g_Keys.names.cs));
@ -61,7 +62,7 @@ int main(int argc, char *argv[])
return EXIT_FAILURE;
}
std::cout << "Reflector " << callsign << "started and listening" << std::endl;
std::cout << "Reflector " << callsign << " started and listening" << std::endl;
// write new pid file
std::ofstream ofs(pidpath, std::ofstream::out);

@ -27,7 +27,7 @@ DBUTIL = dbutil
include configure.mk
ifeq ($(debug), true)
CFLAGS = -ggdb3 -DDEBUG -W -Werror -c -std=c++11 -MMD -MD
CFLAGS = -ggdb3 -DDEBUG -W -Werror -std=c++11 -MMD -MD
else
CFLAGS = -W -Werror -std=c++11 -MMD -MD
endif

@ -22,7 +22,7 @@
////////////////////////////////////////////////////////////////////////////////////////
// constructor
CPacketStream::CPacketStream()
CPacketStream::CPacketStream(char module) : m_PSModule(module)
{
m_bOpen = false;
m_uiStreamId = 0;
@ -31,12 +31,13 @@ CPacketStream::CPacketStream()
m_CodecStream = nullptr;
}
bool CPacketStream::InitPacketStream(bool is_transcoded)
bool CPacketStream::InitCodecStream()
{
if (is_transcoded)
m_CodecStream = std::unique_ptr<CCodecStream>(new CCodecStream(this));
return nullptr == m_CodecStream;
if (m_CodecStream)
return m_CodecStream->InitCodecStream(m_PSModule);
else
return true;
}
////////////////////////////////////////////////////////////////////////////////////////

@ -35,8 +35,8 @@
class CPacketStream : public CPacketQueue
{
public:
CPacketStream();
bool InitPacketStream(bool is_transcoded);
CPacketStream(char module);
bool InitCodecStream();
// open / close
bool OpenPacketStream(const CDvHeaderPacket &, std::shared_ptr<CClient>);
@ -57,6 +57,7 @@ public:
protected:
// data
const char m_PSModule;
bool m_bOpen;
uint16_t m_uiStreamId;
uint32_t m_uiPacketCntr;

@ -114,6 +114,10 @@ protected:
void Send(const CBuffer &buf, const CIp &Ip, uint16_t port) const;
void Send(const char *buf, const CIp &Ip, uint16_t port) const;
void Send(const SM17Frame &frame, const CIp &Ip) const;
#ifdef DEBUG
void Dump(const char *title, const uint8_t *data, int length);
#endif
// socket
CUdpSocket m_Socket4;

@ -76,10 +76,15 @@ bool CReflector::Start(void)
// start one thread per reflector module
for (auto c : m_Modules)
{
auto stream = std::make_shared<CPacketStream>();
auto stream = std::make_shared<CPacketStream>(c);
if (stream)
{
stream->InitPacketStream(std::string::npos != tcmods.find(c));
// if it's a transcoded module, then we need to initialize the codec stream
if (std::string::npos != tcmods.find(c))
{
if (stream->InitCodecStream())
return true;
}
}
else
{

Loading…
Cancel
Save

Powered by TurnKey Linux.