[serial_proxy] Reset the mode when a subscription is taken over

A client taking over from a crashed subscriber inherited that session's
mode; end the dead session with reset_mode_() before handing over the
port, matching every other subscriber-change path.
This commit is contained in:
kbx81
2026-09-02 23:48:17 -05:00
parent fa5e784cbe
commit 4437a0bd7f
@@ -372,6 +372,10 @@ SerialProxyResult SerialProxy::serial_proxy_request(api::APIConnection *api_conn
return SerialProxyResult::SERIAL_PROXY_RESULT_PORT_IN_USE;
}
ESP_LOGW(TAG, "Previous subscriber disconnected; taking over subscription");
// End the dead client's session before starting the new one, so its mode
// cannot leak into a session that never asked for it
this->api_connection_ = nullptr;
this->reset_mode_();
}
this->api_connection_ = api_connection;
this->enable_loop();