Found in the PR #170 review.
Defect: impl Drop for ClientHandler (client_handler/mod.rs) calls stats.client_disconnected() whenever client_id is set. That includes handshakes that failed and never called client_connected().
Effect:
- In debug builds, the next connection's handler panics with "attempt to add with overflow" (
sys_topics.rs) after its CONNACK, which kills that connection.
- In release builds, the
$SYS connected-clients count wraps around.
Fix: decrement only if this handler incremented the count, for example with a flag set when client_connected() runs.
Found in the PR #170 review.
Defect:
impl Drop for ClientHandler(client_handler/mod.rs) callsstats.client_disconnected()wheneverclient_idis set. That includes handshakes that failed and never calledclient_connected().Effect:
sys_topics.rs) after its CONNACK, which kills that connection.$SYSconnected-clients count wraps around.Fix: decrement only if this handler incremented the count, for example with a flag set when
client_connected()runs.