Skip to content

Prevent stopped WebSockets from reconnecting - #528

Open
JamBalaya56562 wants to merge 1 commit into
duplicati:mainfrom
JamBalaya56562:fix/websocket-stop-cleanup
Open

JamBalaya56562 wants to merge 1 commit into
duplicati:mainfrom
JamBalaya56562:fix/websocket-stop-cleanup

Conversation

@JamBalaya56562

Copy link
Copy Markdown
Contributor

Stopping the WebSocket transport could still open another socket: a scheduled retry survived stop(), and a pending authentication refresh called reconnect() after stopping. An old socket or refresh callback could also affect a connection started subsequently.

This change clears the retry timer, detaches and closes the socket, sets the disconnected state, and closes the transport's disconnected dialog on stop. Connection generations prevent callbacks from a previous connection from reconnecting or changing current state. Explicit restart retains subscriptions, while normal five-second retries and authentication refresh remain supported.

Validation

  • Before the fix: 7 of the initial 13 tests failed, reproducing connections after stop, refresh-driven replacement of a restarted socket, and stale state updates; 6 normal-path tests passed.
  • After the fix: all initial 13 passed. Added three further cases for failed refresh after restart and the normal timed retry following a failed 4401 refresh, for 16 lifecycle tests in total.
  • bun install --frozen-lockfile and Prettier check passed.
  • bun run test:ci: 36 files / 380 tests passed.
  • bun run gen:font and bun run ng -- build ngclient --configuration production passed.

Tests use a fake WebSocket, controlled RxJS Subjects, fake timers, and a dialog fake. No real WebSocket server or manual GUI reproduction was used. Shared authentication behavior, API types, dependencies, and lockfiles are unchanged.

Part of #273. Related to #283; this does not claim to resolve every reconnection issue.

@JamBalaya56562
JamBalaya56562 force-pushed the fix/websocket-stop-cleanup branch 4 times, most recently from d6b94b7 to e94ab14 Compare September 15, 2026 10:04
@JamBalaya56562
JamBalaya56562 force-pushed the fix/websocket-stop-cleanup branch from e94ab14 to 82389ac Compare September 15, 2026 20:43
@JamBalaya56562
JamBalaya56562 force-pushed the fix/websocket-stop-cleanup branch from 82389ac to fca6c46 Compare September 17, 2026 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant