@@ -45,10 +45,7 @@ const CONNECTION_ESTABLISHMENT_TIMEOUT = "15 seconds";
4545const establishmentTimeout = Duration . fromInputUnsafe ( CONNECTION_ESTABLISHMENT_TIMEOUT ) ;
4646const synchronizationTimeout = Duration . fromInputUnsafe ( "75 seconds" ) ;
4747const CONNECTION_PROBE_TIMEOUT = "15 seconds" ;
48- // Mobile resumes, explicit retries, and offline events want a fast answer:
49- // the user is waiting, or the network may be gone. It still has to cover a
50- // lost packet and its retransmit on a 500ms round trip, or a slow link reads
51- // as a dead socket and every resume tears down a working session.
48+ // Leave room for packet retransmission before replacing a slow but working link.
5249const QUICK_CONNECTION_PROBE_TIMEOUT = "6 seconds" ;
5350const BACKOFF_RESET_AFTER_MS = 30_000 ;
5451const BETTER_ROUTE_CHECK_INTERVAL = "60 seconds" ;
@@ -595,13 +592,12 @@ export const make = Effect.fn("EnvironmentSupervisor.make")(function* (
595592 continue ;
596593 }
597594 yield * Ref . set ( probeUnanswered , true ) ;
598- const probe = yield * Effect . forkChild ( lease . session . probe ) ;
599- // Monotonic nanoseconds, so a wall-clock correction cannot move the deadline.
600595 const probeStartedAt = yield * Clock . monotonicTimeNanos ;
601596 const latestDeadline = probeStartedAt + Duration . toNanosUnsafe ( CONNECTION_PROBE_TIMEOUT ) ;
602597 let probeWindow = probeTimeout ;
603598 let deadline = probeStartedAt + Duration . toNanosUnsafe ( probeWindow ) ;
604599 let receivedFrames = yield * lease . session . receivedFrames ;
600+ const probe = yield * Effect . forkChild ( lease . session . probe ) ;
605601 for ( ; ; ) {
606602 const remaining = deadline - ( yield * Clock . monotonicTimeNanos ) ;
607603 const probeEvent = yield * Effect . raceAllFirst ( [
@@ -614,9 +610,7 @@ export const make = Effect.fn("EnvironmentSupervisor.make")(function* (
614610 ) ,
615611 ] ) ;
616612 if ( probeEvent . _tag === "TimedOut" ) {
617- // Frames still arriving mean a slow link, not a dead one: the answer
618- // may be queued behind them. Wait another window, up to the full
619- // probe timeout.
613+ // The reply may be behind other traffic; the absolute cap still bounds a stuck probe.
620614 const received = yield * lease . session . receivedFrames ;
621615 const now = yield * Clock . monotonicTimeNanos ;
622616 if ( received > receivedFrames && now < latestDeadline ) {
0 commit comments