Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(client-runtime): connections switch without showing a reconnect #30835

Openlevelorbit(GitHub profile, opens in a new tab)wants to merge 18 commits intomain fromrefs/pull/30835/headopened View on GitHub

Showing 4 changed files with 7 additions and 3 deletions (loading 2).

x
0 of 4 viewed, 4 left
6 additions and 2 deletionsdocs/internals/09_connection-runtime.mdModified
View file
@@ -11,8 +11,12 @@
failures use jittered, capped exponential backoff that resets only after a connection stays up;
offline and auth failures wait for an explicit wakeup.
- Foregrounding, network changes, explicit retries, offline reports, and a request the socket
- leaves unanswered probe the established session rather than blindly reconnecting (OS offline
- reports are often wrong, especially for loopback). Only a failed probe replaces the socket.
+ leaves unanswered probe the established session rather than tearing it down (OS offline reports
+ are often wrong, especially for loopback). When the host answers a fresh request while the socket
+ stays silent, on non-loopback network changes, or when a better route appears, a replacement
+ connects beside the live session and takes over in place without showing a reconnect; a
+ non-upgrade replacement closes if the live socket proves alive, and a worse-route replacement
+ waits as fallback.
- The [registry](../../packages/client-runtime/src/connection/registry.ts) scopes connections by
environment. An involuntary disconnect keeps the registration and cached projections; explicit
removal closes the scope and clears credentials, caches, and drafts. Cloud-account changes apply
1 addition and 1 deletionpackages/client-runtime/src/connection/driver.tsModified
View file
@@ -62,7 +62,7 @@
const ROUTE_CHECK_TIMEOUT_MS = 2_500;
// Preferred direct routes share one head start, so a relay connection does not
// wait the full probe timeout for a LAN the device has already left. A route
-// that misses it connects over relay, then upgrades with a second reconnect.
+// that misses it connects over relay, then upgrades over a second connection.
const ROUTE_CHECK_HEAD_START_MS = 500;
​
export class ConnectionDriver extends Context.Service<