From c8972f8075224f8512d82b37296e4d6d8c736b3b Mon Sep 17 00:00:00 2001 From: Tom Early Date: Mon, 20 May 2024 14:45:09 -0700 Subject: [PATCH] recovering from a closed TCP connection --- Controller.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/Controller.cpp b/Controller.cpp index 82c78a7..587fbdd 100644 --- a/Controller.cpp +++ b/Controller.cpp @@ -250,17 +250,12 @@ void CController::ReadReflectorThread() { while (keep_running) { + // preemptively check the connection(s)... + tcClient.ReConnect(); + std::queue> queue; // wait up to 100 ms to read something on the unix port - if (tcClient.Receive(queue, 100)) - { - if (tcClient.ReConnect()) - { - std::cerr << "Unrecoverable ERROR! Quitting..." << std::endl; - exit(1); - } - } - + tcClient.Receive(queue, 100); while (! queue.empty()) { // create a shared pointer to a new packet