From 7be3138fc51f259b876f189bb82a1a92d892d201 Mon Sep 17 00:00:00 2001 From: "torlando-agent[bot]" <281092095+torlando-agent[bot]@users.noreply.github.com> Date: Fri, 19 Jun 2026 22:54:49 -0400 Subject: [PATCH] fix(tcp): drop redundant _online write in the task to remove a race (greptile) task_loop() set `_online = true` during the CONNECTING window, which races with loop()'s `_online = false` on the main loop (plain bool, no synchronizes-with). It's redundant: the main loop sets `_online = true` when it observes CONNECTED. Removing it eliminates the race with no behaviour change. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01UWZuYkHBRqNb6BZHV8sTG5 --- src/TCPClientInterface.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/TCPClientInterface.cpp b/src/TCPClientInterface.cpp index 6aff3b10..149eb2f6 100644 --- a/src/TCPClientInterface.cpp +++ b/src/TCPClientInterface.cpp @@ -290,7 +290,9 @@ void TCPClientInterface::task_loop() { if (connect()) { _frame_buffer.clear(); _last_data_received = millis(); - _online = true; + // _online is owned by the main loop (it sets it on + // observing CONNECTED); writing it here would race with + // loop()'s `_online = false` during the CONNECTING window. _reconnected.store(true); // main loop announces _conn_state.store(CONNECTED); // hand _client to main loop } else {