tweaking how the TC socket deals with errors

main
Tom Early 2 years ago
parent 07509bd347
commit 71aff90304

@ -47,7 +47,7 @@ bool CController::Start()
usrp_rx_num = calcNumerator(g_Conf.GetGain(EGainType::usrprx)); usrp_rx_num = calcNumerator(g_Conf.GetGain(EGainType::usrprx));
usrp_tx_num = calcNumerator(g_Conf.GetGain(EGainType::usrptx)); usrp_tx_num = calcNumerator(g_Conf.GetGain(EGainType::usrptx));
if (InitVocoders() || tcClient.Initialize(g_Conf.GetAddress(), g_Conf.GetTCMods(), g_Conf.GetPort())) if (InitVocoders() || tcClient.Open(g_Conf.GetAddress(), g_Conf.GetTCMods(), g_Conf.GetPort()))
{ {
keep_running = false; keep_running = false;
return true; return true;
@ -250,12 +250,17 @@ void CController::ReadReflectorThread()
{ {
while (keep_running) while (keep_running)
{ {
tcClient.ReConnect();
std::queue<std::unique_ptr<STCPacket>> queue; std::queue<std::unique_ptr<STCPacket>> queue;
// wait up to 100 ms to read something on the unix port // wait up to 100 ms to read something on the unix port
if (tcClient.Receive(queue, 100)) if (tcClient.Receive(queue, 100))
{ {
if (tcClient.ReConnect())
{
std::cerr << "Unrecoverable ERROR! Quitting..." << std::endl;
exit(1);
}
}
while (! queue.empty()) while (! queue.empty())
{ {
// create a shared pointer to a new packet // create a shared pointer to a new packet
@ -291,7 +296,6 @@ void CController::ReadReflectorThread()
} }
} }
} }
}
// This is only called when codec_in was dstar or dmr. Obviously, the incoming // This is only called when codec_in was dstar or dmr. Obviously, the incoming
// ambe packet was already decoded to audio. // ambe packet was already decoded to audio.
@ -602,7 +606,14 @@ void CController::ProcessUSRPThread()
void CController::SendToReflector(std::shared_ptr<CTranscoderPacket> packet) void CController::SendToReflector(std::shared_ptr<CTranscoderPacket> packet)
{ {
// send the packet over the socket // send the packet over the socket
tcClient.Send(packet->GetTCPacket()); while (tcClient.Send(packet->GetTCPacket()))
{
if (tcClient.ReConnect())
{
std::cerr << "Unrecoverable ERROR, quiting!" << std::endl;
exit(1);
}
}
packet->Sent(); packet->Sent();
} }

Loading…
Cancel
Save

Powered by TurnKey Linux.