From 681925779b0d6defc939966ce9cd42ce4284e72a Mon Sep 17 00:00:00 2001 From: Sijmen Huizenga Date: Wed, 13 May 2026 10:30:12 +0200 Subject: [PATCH] Preserve stream spec on Disconnect so reconnects can succeed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After Disconnect(), params_.stream_ was cleared, but the worker thread's reconnect path calls Connect() which re-reads params_.stream_ to decide between TCP and serial. With an empty string both prefix checks fail and the driver logs "Bad stream spec:" and gives up — permanently, since the config is gone. The only recovery is a process restart. Reproduction: trigger a sensor SYSTEM_REBOOT via the HTTP API. The TCP read returns ECONNRESET, the worker calls Disconnect() (which clears the stream), then loops calling Connect() every reconnect_delay_ seconds — all of which now fail with an empty stream spec. Fix: don't clear params_.stream_ on disconnect. The field is the connection config, not connection state — it should persist for the lifetime of the driver instance. --- fixposition_driver_lib/src/fixposition_driver.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/fixposition_driver_lib/src/fixposition_driver.cpp b/fixposition_driver_lib/src/fixposition_driver.cpp index c23b288..d837817 100644 --- a/fixposition_driver_lib/src/fixposition_driver.cpp +++ b/fixposition_driver_lib/src/fixposition_driver.cpp @@ -84,7 +84,6 @@ void FixpositionDriver::Disconnect() { DisconnectTcp(); } sensor_fd_ = -1; - params_.stream_.clear(); } }