port is 16-bit

pull/1/head
Tom Early 3 years ago
parent d40bb4f94b
commit afa30d7c8e

@ -73,6 +73,7 @@ public:
// get // get
const CCallsign &GetReflectorCallsign(void)const { return m_ReflectorCallsign; } const CCallsign &GetReflectorCallsign(void)const { return m_ReflectorCallsign; }
uint16_t GetPort(void) const { return m_Port; }
// task // task
void Thread(void); void Thread(void);
@ -135,7 +136,7 @@ protected:
CCallsign m_ReflectorCallsign; CCallsign m_ReflectorCallsign;
// data // data
uint8_t m_Port; uint16_t m_Port;
// debug // debug
CTimer m_DebugTimer; CTimer m_DebugTimer;
}; };

@ -275,16 +275,19 @@ void CReflector::RouterThread(const char ThisModule)
m_Protocols.Lock(); m_Protocols.Lock();
for ( auto it=m_Protocols.begin(); it!=m_Protocols.end(); it++ ) for ( auto it=m_Protocols.begin(); it!=m_Protocols.end(); it++ )
{ {
// make a copy! after the Push(tmp), tmp will be nullptr!
auto tmp = packet;
// if packet is header, update RPT2 according to protocol // if packet is header, update RPT2 according to protocol
if ( packet->IsDvHeader() ) if ( tmp->IsDvHeader() )
{ {
// get our callsign // get our callsign
CCallsign csRPT = (*it)->GetReflectorCallsign(); CCallsign csRPT = (*it)->GetReflectorCallsign();
csRPT.SetCSModule(ThisModule); csRPT.SetCSModule(ThisModule);
(dynamic_cast<CDvHeaderPacket *>(packet.get()))->SetRpt2Callsign(csRPT); std::cout << "For protocol on port " << (*it)->GetPort() << ", Rpt2Callsign is " << csRPT << std::endl;
(dynamic_cast<CDvHeaderPacket *>(tmp.get()))->SetRpt2Callsign(csRPT);
} }
// make a copy! after the Push(tmp), tmp will be nullptr!
auto tmp = packet;
(*it)->Push(tmp); (*it)->Push(tmp);
} }
m_Protocols.Unlock(); m_Protocols.Unlock();

Loading…
Cancel
Save

Powered by TurnKey Linux.