| 54 | } |
| 55 | |
| 56 | void HttpConnection::onConnected(u32 currentTimeMs) { |
| 57 | if (mState == ConnectionState::CONNECTING || mState == ConnectionState::RECONNECTING) { |
| 58 | // Reset attempts if we were in RECONNECTING state before entering CONNECTING |
| 59 | // This detects successful reconnection after disconnect |
| 60 | bool shouldResetAttempts = mWasReconnecting || (mState == ConnectionState::RECONNECTING); |
| 61 | |
| 62 | transitionTo(ConnectionState::CONNECTED, currentTimeMs); |
| 63 | |
| 64 | if (shouldResetAttempts) { |
| 65 | resetReconnectAttempts(); // Successful reconnection, reset counter |
| 66 | } else { |
| 67 | resetReconnectState(); // Initial connection, just reset timing |
| 68 | } |
| 69 | |
| 70 | mWasReconnecting = false; |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | void HttpConnection::onDisconnected() { |
| 75 | if (mState == ConnectionState::CONNECTED || mState == ConnectionState::CONNECTING) { |
no outgoing calls
no test coverage detected