Files
hapi/hub/src
Haoqing WangandGitHub 92d368599b fix(hub): allow terminal re-registration after socket reconnect (#434)
* fix(hub): allow terminal re-registration after socket reconnect

When a web client reconnects (common in PWAs and after network
hiccups), it retains the same terminal ID but gets a new socket ID.
The previous code rejected the registration because the old entry
still existed, producing "Terminal ID is already in use".

Now the registry treats a different-socket registration for the same
terminal ID as a stale entry and cleans it up before re-registering.
Same-socket re-registration returns the existing entry (idempotent).
Terminal IDs are client-generated UUIDs so cross-client collisions
are not a realistic concern.

Closes #345

* fix(hub): skip terminal quota check on reconnect

When a stale terminal entry still occupies a slot, the per-session
and per-socket quota checks reject the reconnecting client before
register() can clean up the stale entry. Detect reconnects (same
terminalId + sessionId already registered) and bypass quota checks
so the stale entry is properly replaced in register().

* fix(hub): reject cross-session terminal ID reuse

Only allow stale-entry replacement when the existing entry belongs
to the same session. If a different session happens to present the
same terminal ID, reject it as before to prevent one session from
evicting another session's active terminal.
2026-04-11 17:40:56 +08:00
..
2026-01-27 19:51:21 +08:00
2026-01-27 19:51:21 +08:00
2026-01-27 19:51:21 +08:00
2026-01-27 19:51:21 +08:00
2026-01-27 19:51:21 +08:00
2026-01-27 19:51:21 +08:00