Commit 135bb4b
fix(sdk): reset Accounts._lastLoginTokenWhenPolled on SDK disconnect
Belt-and-suspenders for the EE force-logout path. The existing recovery
mechanisms (useForceLogout via stream message; _reconnectStopper via
fire('reset') calling makeClientLoggedOut on auth failure) BOTH clear
_lastLoginTokenWhenPolled when they run. But in microservices the
notify-user/<uid>/force_logout stream traverses
rocketchat-main → broker → ddp-streamer → WS while the close fires
directly on ddp-streamer — so the stream message can be lost mid-flight,
leaving useForceLogout out of the picture. _reconnectStopper still
covers that case by retrying with the stale token and falling into
makeClientLoggedOut, but only if a previous successful login registered
the stopper.
Wire a direct sdk.connection.on('disconnected') listener that nulls
_lastLoginTokenWhenPolled. The next _pollStoredLoginToken call (from
the 3s timer or a test's loginByUserState) now always compares against
null and fires a login if a token is stored, regardless of whether the
two earlier paths ran.
In normal blip-and-recover network drops the SDK auto-relogin succeeds
and the next poll re-sends a (no-op for the server) login resume — extra
roundtrip but no user-visible effect.
Verified locally with e2ee-passphrase-management :76/:87 and
e2ee-key-reset (force-logout) all green.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 7742877 commit 135bb4b
1 file changed
Lines changed: 19 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
1 | 2 | | |
2 | 3 | | |
3 | 4 | | |
| |||
247 | 248 | | |
248 | 249 | | |
249 | 250 | | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
0 commit comments