minor cleanup

unstable
Tom Early 4 years ago
parent 55deafb30c
commit d013a3d532

@ -22,11 +22,6 @@
#include "DVFramePacket.h" #include "DVFramePacket.h"
#include "Reflector.h" #include "Reflector.h"
////////////////////////////////////////////////////////////////////////////////////////
// define
//////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////
// constructor // constructor
@ -198,7 +193,7 @@ void CCodecStream::Task(void)
} }
else else
{ {
std::cout << "Unexpected transcoded packet received from ambed" << std::endl; std::cout << "Unexpected transcoded packet received from transcoder" << std::endl;
} }
} }
} }

@ -18,7 +18,6 @@
#pragma once #pragma once
#include "Semaphore.h"
#include "UDPSocket.h" #include "UDPSocket.h"
#include "PacketQueue.h" #include "PacketQueue.h"

@ -69,7 +69,7 @@ $(EXE) : $(OBJS)
g++ $(CFLAGS) $< -o $@ g++ $(CFLAGS) $< -o $@
clean : clean :
$(RM) *.o *.d ulxd xrfd $(RM) *.o *.d urfd
-include $(DEPS) -include $(DEPS)

@ -94,7 +94,7 @@ bool CReflector::Start(void)
for (auto it=m_Modules.cbegin(); it!=m_Modules.cend(); it++) for (auto it=m_Modules.cbegin(); it!=m_Modules.cend(); it++)
{ {
m_Stream[*it] = std::make_shared<CPacketStream>(); m_Stream[*it] = std::make_shared<CPacketStream>();
m_RouterFuture[*it] = std::async(std::launch::async, &CReflector::RouterThread, this, m_Stream[*it]); m_RouterFuture[*it] = std::async(std::launch::async, &CReflector::RouterThread, this, *it);
} }
// start the reporting threads // start the reporting threads
@ -255,16 +255,12 @@ void CReflector::CloseStream(std::shared_ptr<CPacketStream> stream)
//////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////
// router threads // router threads
void CReflector::RouterThread(std::shared_ptr<CPacketStream> streamIn) void CReflector::RouterThread(const char ThisModule)
{ {
// get our module
const auto module = GetStreamModule(streamIn);
// get on input queue
std::unique_ptr<CPacket> packet;
while (keep_running) while (keep_running)
{ {
std::unique_ptr<CPacket> packet;
auto streamIn = m_Stream[ThisModule];
// any packet in our input queue ? // any packet in our input queue ?
streamIn->Lock(); streamIn->Lock();
if ( !streamIn->empty() ) if ( !streamIn->empty() )
@ -282,7 +278,7 @@ void CReflector::RouterThread(std::shared_ptr<CPacketStream> streamIn)
if ( packet != nullptr ) if ( packet != nullptr )
{ {
// set origin // set origin
packet->SetModule(module); packet->SetModule(ThisModule);
// iterate on all protocols // iterate on all protocols
m_Protocols.Lock(); m_Protocols.Lock();
@ -296,7 +292,7 @@ void CReflector::RouterThread(std::shared_ptr<CPacketStream> streamIn)
{ {
// get our callsign // get our callsign
CCallsign csRPT = (*it)->GetReflectorCallsign(); CCallsign csRPT = (*it)->GetReflectorCallsign();
csRPT.SetModule(GetStreamModule(streamIn)); csRPT.SetModule(ThisModule);
(dynamic_cast<CDvHeaderPacket *>(packetClone.get()))->SetRpt2Callsign(csRPT); (dynamic_cast<CDvHeaderPacket *>(packetClone.get()))->SetRpt2Callsign(csRPT);
} }

@ -87,7 +87,7 @@ public:
protected: protected:
// threads // threads
void RouterThread(std::shared_ptr<CPacketStream>); void RouterThread(const char);
void XmlReportThread(void); void XmlReportThread(void);
#ifdef JSON_MONITOR #ifdef JSON_MONITOR
void JsonReportThread(void); void JsonReportThread(void);
@ -130,7 +130,10 @@ protected:
// threads // threads
std::atomic<bool> keep_running; std::atomic<bool> keep_running;
std::unordered_map<char, std::future<void>> m_RouterFuture; std::unordered_map<char, std::future<void>> m_RouterFuture;
std::future<void> m_XmlReportFuture /*, m_JsonReportFuture*/; std::future<void> m_XmlReportFuture;
#ifdef JSON_MONITOR
std::future<void> m_JsonReportFuture;
#endif
// notifications // notifications
CNotificationQueue m_Notifications; CNotificationQueue m_Notifications;

Loading…
Cancel
Save

Powered by TurnKey Linux.