@moq/net 0.4.7 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -1
- package/announce.d.ts +1 -1
- package/announce.d.ts.map +1 -1
- package/announce.js +1 -2
- package/announce.js.map +1 -1
- package/announced.d.ts +51 -47
- package/announced.d.ts.map +1 -1
- package/announced.js +183 -32
- package/announced.js.map +1 -1
- package/announced.test-util.d.ts +2 -0
- package/announced.test-util.d.ts.map +1 -0
- package/announced.test-util.js +27 -0
- package/announced.test-util.js.map +1 -0
- package/auth.d.ts +64 -0
- package/auth.d.ts.map +1 -0
- package/auth.js +20 -0
- package/auth.js.map +1 -0
- package/auth_gate.d.ts +2 -0
- package/auth_gate.d.ts.map +1 -0
- package/auth_gate.js +24 -0
- package/auth_gate.js.map +1 -0
- package/auth_session.d.ts +49 -0
- package/auth_session.d.ts.map +1 -0
- package/auth_session.js +1097 -0
- package/auth_session.js.map +1 -0
- package/bandwidth.d.ts +129 -25
- package/bandwidth.d.ts.map +1 -1
- package/bandwidth.js +410 -139
- package/bandwidth.js.map +1 -1
- package/bandwidth_api.d.ts +1 -1
- package/bandwidth_api.d.ts.map +1 -1
- package/bandwidth_api.js +1 -2
- package/bandwidth_api.js.map +1 -1
- package/broadcast.d.ts +64 -38
- package/broadcast.d.ts.map +1 -1
- package/broadcast.js +556 -173
- package/broadcast.js.map +1 -1
- package/cache.d.ts +103 -0
- package/cache.d.ts.map +1 -0
- package/cache.js +254 -0
- package/cache.js.map +1 -0
- package/claim.test-util.d.ts +5 -0
- package/claim.test-util.d.ts.map +1 -0
- package/claim.test-util.js +13 -0
- package/claim.test-util.js.map +1 -0
- package/connection/accept.d.ts +21 -13
- package/connection/accept.d.ts.map +1 -1
- package/connection/accept.js +97 -130
- package/connection/accept.js.map +1 -1
- package/connection/browser.d.ts.map +1 -1
- package/connection/browser.js +28 -20
- package/connection/browser.js.map +1 -1
- package/connection/connect.d.ts +120 -24
- package/connection/connect.d.ts.map +1 -1
- package/connection/connect.js +535 -217
- package/connection/connect.js.map +1 -1
- package/connection/dials.d.ts +45 -0
- package/connection/dials.d.ts.map +1 -0
- package/connection/dials.js +109 -0
- package/connection/dials.js.map +1 -0
- package/connection/endpoint.d.ts +60 -0
- package/connection/endpoint.d.ts.map +1 -0
- package/connection/endpoint.js +114 -0
- package/connection/endpoint.js.map +1 -0
- package/connection/forward.d.ts +7 -1
- package/connection/forward.d.ts.map +1 -1
- package/connection/forward.js +265 -81
- package/connection/forward.js.map +1 -1
- package/connection/goaway.d.ts +16 -9
- package/connection/goaway.d.ts.map +1 -1
- package/connection/goaway.js +22 -95
- package/connection/goaway.js.map +1 -1
- package/connection/handshake.d.ts +34 -8
- package/connection/handshake.d.ts.map +1 -1
- package/connection/handshake.js +97 -21
- package/connection/handshake.js.map +1 -1
- package/connection/index.d.ts +4 -7
- package/connection/index.d.ts.map +1 -1
- package/connection/index.js +1 -3
- package/connection/index.js.map +1 -1
- package/connection/liveness.d.ts +14 -0
- package/connection/liveness.d.ts.map +1 -0
- package/connection/liveness.js +30 -0
- package/connection/liveness.js.map +1 -0
- package/connection/pool.d.ts +142 -63
- package/connection/pool.d.ts.map +1 -1
- package/connection/pool.js +281 -118
- package/connection/pool.js.map +1 -1
- package/connection/reload.d.ts +60 -12
- package/connection/reload.d.ts.map +1 -1
- package/connection/reload.js +859 -234
- package/connection/reload.js.map +1 -1
- package/connection/session.d.ts +91 -0
- package/connection/session.d.ts.map +1 -0
- package/connection/session.js +2 -0
- package/connection/session.js.map +1 -0
- package/connection/stats.d.ts +20 -11
- package/connection/stats.d.ts.map +1 -1
- package/connection/stats.js +64 -9
- package/connection/stats.js.map +1 -1
- package/connection/ticker.d.ts +4 -0
- package/connection/ticker.d.ts.map +1 -0
- package/connection/ticker.js +66 -0
- package/connection/ticker.js.map +1 -0
- package/connection/tokens.d.ts +2 -0
- package/connection/tokens.d.ts.map +1 -0
- package/connection/tokens.js +404 -0
- package/connection/tokens.js.map +1 -0
- package/connection/transport.d.ts.map +1 -1
- package/connection/transport.js +4 -5
- package/connection/transport.js.map +1 -1
- package/connection/withdrawal.d.ts +2 -0
- package/connection/withdrawal.d.ts.map +1 -0
- package/connection/withdrawal.js +23 -0
- package/connection/withdrawal.js.map +1 -0
- package/consume.js +213 -47
- package/consume.js.map +1 -1
- package/cover.d.ts +59 -0
- package/cover.d.ts.map +1 -0
- package/cover.js +375 -0
- package/cover.js.map +1 -0
- package/datagram.d.ts +70 -11
- package/datagram.d.ts.map +1 -1
- package/datagram.js +317 -2
- package/datagram.js.map +1 -1
- package/datagram_stream.d.ts +18 -0
- package/datagram_stream.d.ts.map +1 -0
- package/datagram_stream.js +67 -0
- package/datagram_stream.js.map +1 -0
- package/defined.test-util.d.ts +2 -0
- package/defined.test-util.d.ts.map +1 -0
- package/defined.test-util.js +7 -0
- package/defined.test-util.js.map +1 -0
- package/delivered.d.ts +75 -0
- package/delivered.d.ts.map +1 -0
- package/delivered.js +228 -0
- package/delivered.js.map +1 -0
- package/demand.d.ts +173 -0
- package/demand.d.ts.map +1 -0
- package/demand.js +582 -0
- package/demand.js.map +1 -0
- package/drops.d.ts +93 -0
- package/drops.d.ts.map +1 -0
- package/drops.js +283 -0
- package/drops.js.map +1 -0
- package/error.d.ts +120 -21
- package/error.d.ts.map +1 -1
- package/error.js +230 -38
- package/error.js.map +1 -1
- package/errors.d.ts +2 -2
- package/errors.d.ts.map +1 -1
- package/errors.js +2 -3
- package/errors.js.map +1 -1
- package/fill.d.ts +174 -0
- package/fill.d.ts.map +1 -0
- package/fill.js +760 -0
- package/fill.js.map +1 -0
- package/flate/decoder.d.ts +2 -0
- package/flate/decoder.d.ts.map +1 -0
- package/flate/decoder.js +63 -0
- package/flate/decoder.js.map +1 -0
- package/flate/encoder.d.ts +2 -0
- package/flate/encoder.d.ts.map +1 -0
- package/flate/encoder.js +64 -0
- package/flate/encoder.js.map +1 -0
- package/flate/group.d.ts +34 -0
- package/flate/group.d.ts.map +1 -0
- package/flate/group.js +140 -0
- package/flate/group.js.map +1 -0
- package/frame.d.ts +80 -0
- package/frame.d.ts.map +1 -0
- package/frame.js +296 -0
- package/frame.js.map +1 -0
- package/frame.test-util.d.ts +5 -0
- package/frame.test-util.d.ts.map +1 -0
- package/frame.test-util.js +9 -0
- package/frame.test-util.js.map +1 -0
- package/group.d.ts +108 -45
- package/group.d.ts.map +1 -1
- package/group.js +1616 -308
- package/group.js.map +1 -1
- package/group_api.d.ts +7 -0
- package/group_api.d.ts.map +1 -0
- package/group_api.js +7 -0
- package/group_api.js.map +1 -0
- package/hop.d.ts +62 -76
- package/hop.d.ts.map +1 -1
- package/hop.js +92 -65
- package/hop.js.map +1 -1
- package/identity.d.ts +39 -0
- package/identity.d.ts.map +1 -0
- package/identity.js +47 -0
- package/identity.js.map +1 -0
- package/ietf/active_count.d.ts +2 -0
- package/ietf/active_count.d.ts.map +1 -0
- package/ietf/active_count.js +30 -0
- package/ietf/active_count.js.map +1 -0
- package/ietf/aliases.js +69 -36
- package/ietf/aliases.js.map +1 -1
- package/ietf/cluster.d.ts +3 -3
- package/ietf/cluster.js +14 -55
- package/ietf/cluster.js.map +1 -1
- package/ietf/connection.d.ts +1 -31
- package/ietf/connection.d.ts.map +1 -1
- package/ietf/connection.js +305 -144
- package/ietf/connection.js.map +1 -1
- package/ietf/datagram.d.ts +60 -0
- package/ietf/datagram.d.ts.map +1 -0
- package/ietf/datagram.js +152 -0
- package/ietf/datagram.js.map +1 -0
- package/ietf/error.d.ts +3 -3
- package/ietf/error.js +82 -101
- package/ietf/error.js.map +1 -1
- package/ietf/fetch.d.ts +93 -37
- package/ietf/fetch.d.ts.map +1 -1
- package/ietf/fetch.js +172 -94
- package/ietf/fetch.js.map +1 -1
- package/ietf/filter.d.ts +21 -31
- package/ietf/filter.d.ts.map +1 -1
- package/ietf/filter.js +140 -172
- package/ietf/filter.js.map +1 -1
- package/ietf/goaway.d.ts +12 -10
- package/ietf/goaway.d.ts.map +1 -1
- package/ietf/goaway.js +22 -36
- package/ietf/goaway.js.map +1 -1
- package/ietf/hidden.js +1 -2
- package/ietf/hidden.js.map +1 -1
- package/ietf/index.d.ts +8 -20
- package/ietf/index.d.ts.map +1 -1
- package/ietf/index.js +4 -15
- package/ietf/index.js.map +1 -1
- package/ietf/join.d.ts +7 -0
- package/ietf/join.d.ts.map +1 -0
- package/ietf/join.js +234 -0
- package/ietf/join.js.map +1 -0
- package/ietf/message.d.ts +18 -2
- package/ietf/message.d.ts.map +1 -1
- package/ietf/message.js +60 -41
- package/ietf/message.js.map +1 -1
- package/ietf/message.test-util.d.ts +6 -0
- package/ietf/message.test-util.d.ts.map +1 -0
- package/ietf/message.test-util.js +13 -0
- package/ietf/message.test-util.js.map +1 -0
- package/ietf/namespace.d.ts +19 -5
- package/ietf/namespace.d.ts.map +1 -1
- package/ietf/namespace.js +78 -27
- package/ietf/namespace.js.map +1 -1
- package/ietf/object.d.ts +195 -33
- package/ietf/object.d.ts.map +1 -1
- package/ietf/object.js +405 -179
- package/ietf/object.js.map +1 -1
- package/ietf/parameters.d.ts +25 -45
- package/ietf/parameters.d.ts.map +1 -1
- package/ietf/parameters.js +260 -473
- package/ietf/parameters.js.map +1 -1
- package/ietf/priority.d.ts +17 -2
- package/ietf/priority.d.ts.map +1 -1
- package/ietf/priority.js +19 -5
- package/ietf/priority.js.map +1 -1
- package/ietf/properties.d.ts +6 -5
- package/ietf/properties.d.ts.map +1 -1
- package/ietf/properties.js +78 -49
- package/ietf/properties.js.map +1 -1
- package/ietf/publish.d.ts +25 -33
- package/ietf/publish.d.ts.map +1 -1
- package/ietf/publish.js +45 -140
- package/ietf/publish.js.map +1 -1
- package/ietf/publish_namespace.d.ts +49 -72
- package/ietf/publish_namespace.d.ts.map +1 -1
- package/ietf/publish_namespace.js +66 -185
- package/ietf/publish_namespace.js.map +1 -1
- package/ietf/publisher.js +1800 -601
- package/ietf/publisher.js.map +1 -1
- package/ietf/range.d.ts +2 -0
- package/ietf/range.d.ts.map +1 -0
- package/ietf/range.js +222 -0
- package/ietf/range.js.map +1 -0
- package/ietf/request.d.ts +6 -30
- package/ietf/request.d.ts.map +1 -1
- package/ietf/request.js +41 -79
- package/ietf/request.js.map +1 -1
- package/ietf/request_stream.d.ts +1 -6
- package/ietf/request_stream.d.ts.map +1 -1
- package/ietf/request_stream.js +306 -17
- package/ietf/request_stream.js.map +1 -1
- package/ietf/session.d.ts +41 -0
- package/ietf/session.d.ts.map +1 -0
- package/ietf/session.js +65 -0
- package/ietf/session.js.map +1 -0
- package/ietf/setup.d.ts +5 -30
- package/ietf/setup.d.ts.map +1 -1
- package/ietf/setup.js +6 -118
- package/ietf/setup.js.map +1 -1
- package/ietf/setup_options.d.ts +31 -0
- package/ietf/setup_options.d.ts.map +1 -0
- package/ietf/setup_options.js +138 -0
- package/ietf/setup_options.js.map +1 -0
- package/ietf/solicit.js +4 -15
- package/ietf/solicit.js.map +1 -1
- package/ietf/subscribe.d.ts +52 -45
- package/ietf/subscribe.d.ts.map +1 -1
- package/ietf/subscribe.js +118 -240
- package/ietf/subscribe.js.map +1 -1
- package/ietf/subscribe_namespace.d.ts +16 -79
- package/ietf/subscribe_namespace.d.ts.map +1 -1
- package/ietf/subscribe_namespace.js +30 -202
- package/ietf/subscribe_namespace.js.map +1 -1
- package/ietf/subscriber.js +1839 -537
- package/ietf/subscriber.js.map +1 -1
- package/ietf/token.js +105 -28
- package/ietf/token.js.map +1 -1
- package/ietf/track.d.ts +27 -24
- package/ietf/track.d.ts.map +1 -1
- package/ietf/track.js +48 -62
- package/ietf/track.js.map +1 -1
- package/ietf/version.d.ts +13 -42
- package/ietf/version.d.ts.map +1 -1
- package/ietf/version.js +22 -49
- package/ietf/version.js.map +1 -1
- package/implementation.d.ts +2 -0
- package/implementation.d.ts.map +1 -0
- package/implementation.js +5 -0
- package/implementation.js.map +1 -0
- package/index.d.ts +34 -19
- package/index.d.ts.map +1 -1
- package/index.js +19 -7
- package/index.js.map +1 -1
- package/internal.d.ts +1515 -67
- package/internal.d.ts.map +1 -1
- package/internal.js +557 -80
- package/internal.js.map +1 -1
- package/ledger.d.ts +23 -0
- package/ledger.d.ts.map +1 -0
- package/ledger.js +247 -0
- package/ledger.js.map +1 -0
- package/listing.d.ts +132 -0
- package/listing.d.ts.map +1 -0
- package/listing.js +486 -0
- package/listing.js.map +1 -0
- package/lite/announce.d.ts +127 -66
- package/lite/announce.d.ts.map +1 -1
- package/lite/announce.js +384 -159
- package/lite/announce.js.map +1 -1
- package/lite/announce_stream.d.ts +2 -0
- package/lite/announce_stream.d.ts.map +1 -0
- package/lite/announce_stream.js +92 -0
- package/lite/announce_stream.js.map +1 -0
- package/lite/answer.d.ts +22 -0
- package/lite/answer.d.ts.map +1 -0
- package/lite/answer.js +301 -0
- package/lite/answer.js.map +1 -0
- package/lite/auth.d.ts +45 -0
- package/lite/auth.d.ts.map +1 -0
- package/lite/auth.js +204 -0
- package/lite/auth.js.map +1 -0
- package/lite/compat.d.ts +31 -0
- package/lite/compat.d.ts.map +1 -0
- package/lite/compat.js +86 -0
- package/lite/compat.js.map +1 -0
- package/lite/connection.d.ts +1 -45
- package/lite/connection.d.ts.map +1 -1
- package/lite/connection.js +360 -78
- package/lite/connection.js.map +1 -1
- package/lite/datagram-end.d.ts +26 -0
- package/lite/datagram-end.d.ts.map +1 -0
- package/lite/datagram-end.js +30 -0
- package/lite/datagram-end.js.map +1 -0
- package/lite/datagram.d.ts +73 -8
- package/lite/datagram.d.ts.map +1 -1
- package/lite/datagram.js +144 -10
- package/lite/datagram.js.map +1 -1
- package/lite/duration.d.ts +6 -0
- package/lite/duration.d.ts.map +1 -0
- package/lite/duration.js +14 -0
- package/lite/duration.js.map +1 -0
- package/lite/error.d.ts +9 -0
- package/lite/error.d.ts.map +1 -0
- package/lite/error.js +24 -0
- package/lite/error.js.map +1 -0
- package/lite/fills.d.ts +162 -0
- package/lite/fills.d.ts.map +1 -0
- package/lite/fills.js +486 -0
- package/lite/fills.js.map +1 -0
- package/lite/fit.d.ts +49 -0
- package/lite/fit.d.ts.map +1 -0
- package/lite/fit.js +305 -0
- package/lite/fit.js.map +1 -0
- package/lite/goaway.d.ts +2 -2
- package/lite/goaway.d.ts.map +1 -1
- package/lite/goaway.js +5 -14
- package/lite/goaway.js.map +1 -1
- package/lite/group.d.ts +67 -16
- package/lite/group.d.ts.map +1 -1
- package/lite/group.js +108 -31
- package/lite/group.js.map +1 -1
- package/lite/identity.d.ts +25 -0
- package/lite/identity.d.ts.map +1 -0
- package/lite/identity.js +79 -0
- package/lite/identity.js.map +1 -0
- package/lite/index.d.ts +14 -13
- package/lite/index.d.ts.map +1 -1
- package/lite/index.js +2 -2
- package/lite/index.js.map +1 -1
- package/lite/message.d.ts +10 -2
- package/lite/message.d.ts.map +1 -1
- package/lite/message.js +28 -45
- package/lite/message.js.map +1 -1
- package/lite/priority.d.ts +9 -2
- package/lite/priority.d.ts.map +1 -1
- package/lite/priority.js +11 -106
- package/lite/priority.js.map +1 -1
- package/lite/probe.d.ts +2 -2
- package/lite/probe.d.ts.map +1 -1
- package/lite/probe.js +9 -1
- package/lite/probe.js.map +1 -1
- package/lite/publisher.d.ts +10 -1
- package/lite/publisher.d.ts.map +1 -1
- package/lite/publisher.js +2548 -438
- package/lite/publisher.js.map +1 -1
- package/lite/routed.d.ts +59 -0
- package/lite/routed.d.ts.map +1 -0
- package/lite/routed.js +564 -0
- package/lite/routed.js.map +1 -0
- package/lite/session.d.ts +2 -28
- package/lite/session.d.ts.map +1 -1
- package/lite/session.js +0 -100
- package/lite/session.js.map +1 -1
- package/lite/setup.d.ts +32 -5
- package/lite/setup.d.ts.map +1 -1
- package/lite/setup.js +95 -22
- package/lite/setup.js.map +1 -1
- package/lite/stream.d.ts +5 -11
- package/lite/stream.d.ts.map +1 -1
- package/lite/stream.js +5 -2
- package/lite/stream.js.map +1 -1
- package/lite/subscribe.d.ts +478 -78
- package/lite/subscribe.d.ts.map +1 -1
- package/lite/subscribe.js +1373 -143
- package/lite/subscribe.js.map +1 -1
- package/lite/subscriber.d.ts +7 -44
- package/lite/subscriber.d.ts.map +1 -1
- package/lite/subscriber.js +3290 -516
- package/lite/subscriber.js.map +1 -1
- package/lite/track.d.ts +27 -12
- package/lite/track.d.ts.map +1 -1
- package/lite/track.js +116 -38
- package/lite/track.js.map +1 -1
- package/lite/tracks.d.ts +55 -0
- package/lite/tracks.d.ts.map +1 -0
- package/lite/tracks.js +114 -0
- package/lite/tracks.js.map +1 -0
- package/lite/version.d.ts +132 -24
- package/lite/version.d.ts.map +1 -1
- package/lite/version.js +378 -34
- package/lite/version.js.map +1 -1
- package/meta.d.ts +77 -0
- package/meta.d.ts.map +1 -0
- package/meta.js +130 -0
- package/meta.js.map +1 -0
- package/meta_api.d.ts +7 -0
- package/meta_api.d.ts.map +1 -0
- package/meta_api.js +7 -0
- package/meta_api.js.map +1 -0
- package/mint.d.ts +28 -0
- package/mint.d.ts.map +1 -0
- package/mint.js +66 -0
- package/mint.js.map +1 -0
- package/open.d.ts +63 -0
- package/open.d.ts.map +1 -0
- package/open.js +250 -0
- package/open.js.map +1 -0
- package/origin.d.ts +394 -142
- package/origin.d.ts.map +1 -1
- package/origin.js +2533 -687
- package/origin.js.map +1 -1
- package/package.json +8 -13
- package/path.d.ts +51 -51
- package/path.d.ts.map +1 -1
- package/path.js +210 -58
- package/path.js.map +1 -1
- package/payload.d.ts +33 -0
- package/payload.d.ts.map +1 -0
- package/payload.js +65 -0
- package/payload.js.map +1 -0
- package/prefix.d.ts +152 -0
- package/prefix.d.ts.map +1 -0
- package/prefix.js +349 -0
- package/prefix.js.map +1 -0
- package/priority.d.ts +8 -0
- package/priority.d.ts.map +1 -0
- package/priority.js +185 -0
- package/priority.js.map +1 -0
- package/queue.d.ts +2 -0
- package/queue.d.ts.map +1 -0
- package/queue.js +46 -0
- package/queue.js.map +1 -0
- package/ranges.d.ts +36 -0
- package/ranges.d.ts.map +1 -0
- package/ranges.js +312 -0
- package/ranges.js.map +1 -0
- package/rescale.d.ts +24 -0
- package/rescale.d.ts.map +1 -0
- package/rescale.js +39 -0
- package/rescale.js.map +1 -0
- package/resume.d.ts +55 -0
- package/resume.d.ts.map +1 -0
- package/resume.js +4173 -0
- package/resume.js.map +1 -0
- package/resume.test-util.d.ts +2 -0
- package/resume.test-util.d.ts.map +1 -0
- package/resume.test-util.js +25 -0
- package/resume.test-util.js.map +1 -0
- package/skips.d.ts +48 -0
- package/skips.d.ts.map +1 -0
- package/skips.js +182 -0
- package/skips.js.map +1 -0
- package/stream.d.ts +78 -40
- package/stream.d.ts.map +1 -1
- package/stream.js +236 -93
- package/stream.js.map +1 -1
- package/subscription.test-util.d.ts +2 -0
- package/subscription.test-util.d.ts.map +1 -0
- package/subscription.test-util.js +49 -0
- package/subscription.test-util.js.map +1 -0
- package/tail.d.ts +23 -14
- package/tail.d.ts.map +1 -1
- package/tail.js +224 -98
- package/tail.js.map +1 -1
- package/time.d.ts +41 -102
- package/time.d.ts.map +1 -1
- package/time.js +129 -92
- package/time.js.map +1 -1
- package/timed.d.ts +21 -0
- package/timed.d.ts.map +1 -0
- package/timed.js +2 -0
- package/timed.js.map +1 -0
- package/track.d.ts +578 -246
- package/track.d.ts.map +1 -1
- package/track.js +7306 -772
- package/track.js.map +1 -1
- package/track_api.d.ts +7 -0
- package/track_api.d.ts.map +1 -0
- package/track_api.js +7 -0
- package/track_api.js.map +1 -0
- package/util/abort.d.ts +1 -0
- package/util/abort.d.ts.map +1 -1
- package/util/abort.js +23 -2
- package/util/abort.js.map +1 -1
- package/util/announce.d.ts +4 -0
- package/util/announce.d.ts.map +1 -0
- package/util/announce.js +11 -0
- package/util/announce.js.map +1 -0
- package/util/bigint.d.ts +3 -0
- package/util/bigint.d.ts.map +1 -0
- package/util/bigint.js +8 -0
- package/util/bigint.js.map +1 -0
- package/util/change.d.ts +12 -0
- package/util/change.d.ts.map +1 -0
- package/util/change.js +18 -0
- package/util/change.js.map +1 -0
- package/util/deadline.d.ts +2 -0
- package/util/deadline.d.ts.map +1 -0
- package/util/deadline.js +108 -0
- package/util/deadline.js.map +1 -0
- package/util/decode_error.d.ts +3 -0
- package/util/decode_error.d.ts.map +1 -0
- package/util/decode_error.js +11 -0
- package/util/decode_error.js.map +1 -0
- package/util/demand.d.ts +8 -0
- package/util/demand.d.ts.map +1 -0
- package/util/demand.js +24 -0
- package/util/demand.js.map +1 -0
- package/util/given_up.d.ts +2 -0
- package/util/given_up.d.ts.map +1 -0
- package/util/given_up.js +101 -0
- package/util/given_up.js.map +1 -0
- package/util/hex.d.ts +6 -0
- package/util/hex.d.ts.map +1 -1
- package/util/hex.js +19 -5
- package/util/hex.js.map +1 -1
- package/util/key.d.ts +15 -0
- package/util/key.d.ts.map +1 -0
- package/util/key.js +38 -0
- package/util/key.js.map +1 -0
- package/util/limits.d.ts +2 -0
- package/util/limits.d.ts.map +1 -0
- package/util/limits.js +76 -0
- package/util/limits.js.map +1 -0
- package/util/observed.d.ts +23 -0
- package/util/observed.d.ts.map +1 -0
- package/util/observed.js +122 -0
- package/util/observed.js.map +1 -0
- package/util/sorted.d.ts +2 -0
- package/util/sorted.d.ts.map +1 -0
- package/util/sorted.js +149 -0
- package/util/sorted.js.map +1 -0
- package/util/timeout.d.ts +2 -1
- package/util/timeout.d.ts.map +1 -1
- package/util/timeout.js +13 -10
- package/util/timeout.js.map +1 -1
- package/util/timer.d.ts +2 -0
- package/util/timer.d.ts.map +1 -0
- package/util/timer.js +19 -0
- package/util/timer.js.map +1 -0
- package/util/u64.js +0 -1
- package/util/utf8.d.ts +2 -0
- package/util/utf8.d.ts.map +1 -1
- package/util/utf8.js +7 -2
- package/util/utf8.js.map +1 -1
- package/util/varint.d.ts.map +1 -1
- package/util/varint.js +8 -2
- package/util/varint.js.map +1 -1
- package/util/watch.d.ts +8 -0
- package/util/watch.d.ts.map +1 -0
- package/util/watch.js +38 -0
- package/util/watch.js.map +1 -0
- package/util/yield.d.ts +2 -0
- package/util/yield.d.ts.map +1 -0
- package/util/yield.js +31 -0
- package/util/yield.js.map +1 -0
- package/varint.d.ts +0 -29
- package/varint.d.ts.map +1 -1
- package/varint.js +7 -29
- package/varint.js.map +1 -1
- package/varint_api.d.ts +7 -0
- package/varint_api.d.ts.map +1 -0
- package/varint_api.js +7 -0
- package/varint_api.js.map +1 -0
- package/version.d.ts +2 -0
- package/version.d.ts.map +1 -0
- package/version.js +4 -0
- package/version.js.map +1 -0
- package/window.d.ts +570 -0
- package/window.d.ts.map +1 -0
- package/window.js +1677 -0
- package/window.js.map +1 -0
- package/wire.d.ts +150 -35
- package/wire.d.ts.map +1 -1
- package/wire.js +27 -1
- package/wire.js.map +1 -1
- package/connection/established.d.ts +0 -53
- package/connection/established.d.ts.map +0 -1
- package/connection/established.js +0 -3
- package/connection/established.js.map +0 -1
- package/ietf/adapter.d.ts +0 -75
- package/ietf/adapter.d.ts.map +0 -1
- package/ietf/adapter.js +0 -700
- package/ietf/adapter.js.map +0 -1
- package/lite/datagram_stream.d.ts +0 -8
- package/lite/datagram_stream.d.ts.map +0 -1
- package/lite/datagram_stream.js +0 -44
- package/lite/datagram_stream.js.map +0 -1
- package/lite/fetch.d.ts +0 -28
- package/lite/fetch.d.ts.map +0 -1
- package/lite/fetch.js +0 -79
- package/lite/fetch.js.map +0 -1
- package/util/log.d.ts +0 -5
- package/util/log.d.ts.map +0 -1
- package/util/log.js +0 -17
- package/util/log.js.map +0 -1
- package/zod.d.ts +0 -13
- package/zod.d.ts.map +0 -1
- package/zod.js +0 -19
- package/zod.js.map +0 -1
package/connection/reload.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reload.js","sourceRoot":"","sources":["../../src/connection/reload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAgC,IAAI,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAClF,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EA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IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;QACtB,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,CAAC;QACzB,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,SAAS;YAAE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC;IACxE,CAAC;CACD;AAED;;;GAGG;AACH,MAAM,QAAQ;IACb,WAAW,CAAc;IACzB,MAAM,CAAgC;IACtC,SAAS,CAAa;IACtB,QAAQ,GAAG,KAAK,CAAC;IAEjB,YAAY,UAAuB,EAAE,QAAoB,EAAE,QAAoB;QAC9E,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;QAC9B,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAI,CAAC,MAAM,GAAG,UAAU,CAAC,GAAG,EAAE;YAC7B,OAAO,CAAC,IAAI,CAAC,4CAA4C,CAAC,CAAC;YAC3D,IAAI,CAAC,MAAM,EAAE,CAAC;QACf,CAAC,EAAE,QAAQ,CAAC,CAAC;QACb,KAAK,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;IAClD,CAAC;IAED,6EAA6E;IAC7E,MAAM;QACL,IAAI,IAAI,CAAC,QAAQ;YAAE,OAAO;QAC1B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC1B,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC;QACzB,IAAI,CAAC,SAAS,EAAE,CAAC;IAClB,CAAC;CACD","sourcesContent":["import { Effect, type GetPromise, type Getter, Once, Signal } from \"@moq/signals\";\nimport * as Announce from \"../announced.ts\";\nimport { Allocator } from \"../bandwidth.ts\";\nimport { error, SessionCode, SessionError } from \"../error.ts\";\nimport type { Consumer as OriginConsumer, Producer as OriginProducer } from \"../origin.ts\";\nimport * as Path from \"../path.ts\";\nimport * as Time from \"../time.ts\";\nimport { wireOf } from \"../wire.ts\";\nimport { type ConnectProps, connect, type WebSocketProps, type WebTransportProps } from \"./connect.ts\";\nimport type { Established } from \"./established.ts\";\nimport { DEFAULT_HANDOVER, type Drain, dialed, type GoawayProps, handover, pinnedTransport, target } from \"./goaway.ts\";\nimport type { Probe, Stats } from \"./stats.ts\";\n\n/**\n * Exponential backoff settings for the reconnect loop.\n *\n * The delays carry jitter, so a fleet of tabs knocked offline together doesn't reconnect in\n * lockstep. Every failure is retried; {@link ReloadDelay.timeout} is what stops the current\n * URL. A new URL or a disable/re-enable starts another sequence.\n */\nexport type ReloadDelay = {\n\t/** The delay before reconnecting (default: 1000ms). */\n\tinitial?: Time.Milli;\n\n\t/** The multiplier for the delay (default: 2). */\n\tmultiplier?: number;\n\n\t/** The maximum delay (default: 5000ms). */\n\tmax?: Time.Milli;\n\n\t/**\n\t * Maximum total time to spend retrying the current URL before giving up\n\t * (default: 10000ms). Resets after each successful connection, a URL change, or a\n\t * disable/re-enable. Set to 0 for unlimited retries.\n\t */\n\ttimeout?: Time.Milli;\n};\n\n/**\n * Connection and retry options for {@link Reload}.\n *\n * {@link ConnectProps.transport} is excluded: a supplied session is good for exactly one\n * connection, so the reconnect loop has nothing to reuse once that session drops. Call\n * {@link connect} directly when you have a session to hand over.\n *\n * @internal\n */\nexport type ReloadProps = Omit<ConnectProps, \"url\" | \"signal\" | \"transport\"> & {\n\t/** A reload owns the abort signal for each connection attempt. */\n\tsignal?: never;\n\n\t/** A one-shot transport cannot be reused by the reconnect loop. */\n\ttransport?: never;\n\n\t/** Whether to reload the connection when it disconnects (default: true). */\n\tenabled?: boolean | Signal<boolean>;\n\n\t/** The URL of the relay server. */\n\turl?: URL | Signal<URL | undefined>;\n\n\t/** Backoff settings for the reconnect loop; every field falls back to its default. */\n\tdelay?: ReloadDelay;\n\n\t/** How to react to the peer's GOAWAY; every field falls back to its default. */\n\tgoaway?: GoawayProps;\n};\n\n/**\n * The backoff applied to whichever {@link ReloadDelay} fields a caller leaves out.\n *\n * The timeout is short on purpose: a failure that clears within it was transient, and one that\n * doesn't should surface on {@link Reload.error} rather than leave the page silently\n * reconnecting for minutes. A loop nobody watches wants `timeout: 0` instead, since there is\n * no one to react. Giving up does not dispose the loop: a new URL or a disable/re-enable\n * starts another sequence.\n */\nconst DEFAULT_DELAY: Required<ReloadDelay> = {\n\tinitial: Time.Milli(1000),\n\tmultiplier: 2,\n\tmax: Time.Milli(5000),\n\ttimeout: Time.Milli(10000),\n};\n\n/** How often the send-rate estimate is sampled from the live transport. */\nconst BANDWIDTH_POLL = 100;\n\n/** Current state of a reconnecting connection. */\nexport type ReloadStatus = \"connecting\" | \"connected\" | \"disconnected\";\n\n/**\n * The reconnect loop behind a Connection handle: connects, waits for the session to end, then\n * redials with exponential backoff.\n *\n * @internal\n */\nexport class Reload {\n\t/** Relay URL to connect to; updating it triggers a reconnect. */\n\turl: Signal<URL | undefined>;\n\n\t/** Whether reconnecting is active. */\n\tenabled: Signal<boolean>;\n\n\t/** Current connection status. */\n\tstatus = new Signal<ReloadStatus>(\"disconnected\");\n\n\t/**\n\t * The failure that stopped retrying the current URL, or undefined while the loop is live.\n\t *\n\t * Set on an auth rejection or when the retry window expires. Cleared when a new URL or a\n\t * disable/re-enable starts another sequence, not on a page hide/show. Transient drops\n\t * that are still being retried leave this empty.\n\t */\n\treadonly error: Getter<Error | undefined>;\n\n\t/** The currently established session, or undefined while disconnected. */\n\testablished = new Signal<Established | undefined>(undefined);\n\n\t/**\n\t * The current connection's PROBE estimates, spanning reconnects.\n\t *\n\t * Undefined while disconnected: the estimates belong to a single connection.\n\t * See {@link Established.probe}.\n\t */\n\treadonly probe: Getter<Probe | undefined>;\n\n\t/**\n\t * Divides this connection's send-rate estimate among the tracks sharing it.\n\t *\n\t * The same instance across reconnects, so reservations survive a drop. The\n\t * estimate is `undefined` while disconnected, which tells a sender to hold\n\t * its rate rather than encode at zero.\n\t */\n\treadonly bandwidth: Allocator;\n\n\t/** WebTransport options applied to each connection attempt (not reactive). */\n\twebtransport?: WebTransportProps;\n\n\t/** WebSocket fallback options applied to each connection attempt (not reactive). */\n\twebsocket: WebSocketProps | undefined;\n\n\t/**\n\t * Whether the relay supports broadcast discovery, applied to each connection attempt (not\n\t * reactive). Undefined defers to the default for the URL. See {@link Established.discovery}.\n\t */\n\tdiscovery?: boolean;\n\n\t/**\n\t * The origin whose broadcasts are served, spanning reconnects (not reactive).\n\t *\n\t * Each session announces the origin's table when it attaches, so a broadcast published\n\t * while offline surfaces on the next connection and a reconnect re-announces everything\n\t * still published. See the `publish` connect option.\n\t */\n\tpublish?: OriginConsumer;\n\n\t/**\n\t * The origin fed with the peer's announced broadcasts, spanning reconnects (not\n\t * reactive).\n\t *\n\t * The entries a session fed retract when it dies, and the next session re-populates the\n\t * table, so a consumer watching the origin sees offline/online transitions across a\n\t * reconnect. See the `consume` connect option.\n\t */\n\tconsume?: OriginProducer;\n\n\t/** Backoff settings for the reconnect loop; an unset field uses its default. */\n\tdelay: ReloadDelay;\n\n\t/** How to react to the peer's GOAWAY (not reactive). */\n\tgoaway: GoawayProps;\n\n\t/**\n\t * The URL an accepted GOAWAY redirect assigned, or undefined while the loop dials\n\t * {@link Reload.url}. Sticky across reconnects: a redirect is an assignment, not a\n\t * detour. Cleared when a new URL or a disable/re-enable starts another sequence.\n\t */\n\treadonly redirect: Getter<URL | undefined>;\n\n\t/** The reactive effect scope driving the connect loop; closed by {@link Reload.close}. */\n\t#signals = new Effect();\n\n\t// Sampled from the live session; undefined while disconnected or the transport has none.\n\t#estimate = new Signal<number | undefined>(undefined);\n\n\t/**\n\t * Settles once this loop is disposed via {@link Reload.close}: `null` on a clean close,\n\t * or the abort {@link Error}. Peek it synchronously (`undefined` while open), observe it\n\t * reactively, or `await` it. Attempt failures live on {@link Reload.error} instead.\n\t */\n\tget closed(): GetPromise<Error | null> {\n\t\treturn this.#closed;\n\t}\n\n\t#closed = new Once<Error | null>();\n\t#error = new Signal<Error | undefined>(undefined);\n\t#redirect = new Signal<URL | undefined>(undefined);\n\t// The configured href the redirect was assigned for.\n\t#redirectHref: string | undefined;\n\n\t// A session the peer sent GOAWAY on, serving its groups in flight while the replacement\n\t// dials. Retired when it closes, at its handover cap, or when the sequence ends.\n\t#draining: Draining | undefined;\n\n\t// Whether a connect attempt is in flight, so a retiring predecessor reports the right status.\n\t#dialing = false;\n\n\t// The current wait between attempts, doubling per failure, and when the retry window expires.\n\t// Both are undefined between sequences, so a later edit to `delay` applies to the next one.\n\t#delay: DOMHighResTimeStamp | undefined;\n\t#deadline: DOMHighResTimeStamp | undefined;\n\n\t// The URL the current retry sequence is for. Cleared when disabled, URL-less, or given\n\t// up, so the next attempt starts a fresh backoff window.\n\t#sequenceHref: string | undefined;\n\n\t// The href that exhausted its retry sequence. Survives a page hide/show so resume does\n\t// not redial credentials the peer already refused. Cleared when the URL changes or the\n\t// loop is disabled.\n\t#givenUpHref: string | undefined;\n\n\t// Increased by 1 each time to trigger a reload.\n\t#tick = new Signal(0);\n\n\t// True after the browser freezes or hides the page until it visibly resumes.\n\t#suspended = new Signal(false);\n\n\t// Use the serialized URL as the reactive connection key. URL objects use identity\n\t// equality, but replacing one with an equivalent instance should not reconnect.\n\t#url: Getter<string | undefined>;\n\tconstructor(props?: ReloadProps) {\n\t\tthis.url = Signal.from(props?.url);\n\t\tthis.enabled = Signal.from(props?.enabled ?? true);\n\t\tthis.delay = props?.delay ?? {};\n\t\tthis.goaway = props?.goaway ?? {};\n\t\tthis.redirect = this.#redirect;\n\t\tthis.webtransport = props?.webtransport;\n\t\tthis.websocket = props?.websocket;\n\t\tthis.discovery = props?.discovery;\n\t\tthis.publish = props?.publish;\n\t\tthis.consume = props?.consume;\n\n\t\t// Requests on the consume origin stay pending across a reconnect, and before the\n\t\t// first session establishes, rather than reading as unroutable the moment no session\n\t\t// is attached. Released only when this loop is disposed: giving up the current URL\n\t\t// is recoverable (a new URL or a disable/re-enable starts another sequence), so a\n\t\t// request must keep waiting rather than go unroutable in the gap.\n\t\tif (this.consume) {\n\t\t\tthis.#signals.cleanup(wireOf(this.consume).expect());\n\t\t}\n\n\t\tthis.error = this.#error;\n\n\t\tconst win = globalThis.window;\n\t\tconst doc = globalThis.document;\n\t\tif (typeof win !== \"undefined\" && typeof doc !== \"undefined\") {\n\t\t\tthis.#signals.event(win, \"pagehide\", () => this.#suspended.set(true));\n\t\t\tthis.#signals.event(win, \"pageshow\", () => this.#suspended.set(false));\n\t\t\tthis.#signals.event(win, \"unload\", () => this.#suspended.set(true));\n\t\t\tthis.#signals.event(doc, \"visibilitychange\", () => {\n\t\t\t\tif (!doc.hidden) this.#suspended.set(false);\n\t\t\t});\n\t\t}\n\n\t\tthis.probe = this.#signals.computed((effect) => {\n\t\t\tconst connection = effect.get(this.established);\n\t\t\treturn connection && effect.get(connection.probe);\n\t\t});\n\n\t\tthis.bandwidth = new Allocator(this.#estimate);\n\t\tthis.#signals.cleanup(() => this.bandwidth.close());\n\n\t\t// The transport has no event for the send-rate estimate, so sample on our\n\t\t// own schedule and skip a tick while the previous snapshot is outstanding.\n\t\tthis.#signals.run((effect) => {\n\t\t\teffect.set(this.#estimate, undefined);\n\t\t\tconst connection = effect.get(this.established);\n\t\t\tif (!connection) return;\n\n\t\t\tlet pending = false;\n\t\t\tconst sample = async () => {\n\t\t\t\tif (pending) return;\n\t\t\t\tpending = true;\n\t\t\t\ttry {\n\t\t\t\t\tconst stats = await effect.race(connection.stats());\n\t\t\t\t\tif (stats) this.#estimate.set(stats.estimatedSendRate);\n\t\t\t\t} finally {\n\t\t\t\t\tpending = false;\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tvoid sample();\n\t\t\teffect.interval(() => void sample(), BANDWIDTH_POLL);\n\t\t});\n\n\t\tthis.#url = this.#signals.computed((effect) => effect.get(this.url)?.href);\n\t\t// Create a reactive root so cleanup is easier.\n\t\tthis.#signals.run(this.#connect.bind(this));\n\t}\n\n\t#connect(effect: Effect): void {\n\t\t// Will retry when the tick changes.\n\t\teffect.get(this.#tick);\n\n\t\tconst enabled = effect.get(this.enabled);\n\t\tif (!enabled) {\n\t\t\tthis.#givenUpHref = undefined;\n\t\t\tthis.#resetSequence();\n\t\t\tthis.#redirect.set(undefined);\n\t\t\treturn;\n\t\t}\n\n\t\t// Hide/freeze pauses an in-flight sequence without recovering from give-up.\n\t\tconst suspended = effect.get(this.#suspended);\n\t\tif (suspended) {\n\t\t\tthis.#resetSequence();\n\t\t\treturn;\n\t\t}\n\n\t\tconst href = effect.get(this.#url);\n\t\tif (!href) {\n\t\t\tthis.#givenUpHref = undefined;\n\t\t\tthis.#resetSequence();\n\t\t\tthis.#redirect.set(undefined);\n\t\t\treturn;\n\t\t}\n\t\tconst url = new URL(href);\n\n\t\tif (this.#givenUpHref === href) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this.#sequenceHref !== href) {\n\t\t\tthis.#resetSequence();\n\t\t\t// A redirect was assigned for another URL; this one starts from itself. A page\n\t\t\t// hide/show resumes the same URL, so it keeps the assignment.\n\t\t\tif (this.#redirectHref !== href) this.#redirect.set(undefined);\n\t\t\tthis.#sequenceHref = href;\n\t\t\tthis.#error.set(undefined);\n\t\t\tthis.#givenUpHref = undefined;\n\t\t}\n\n\t\t// A drained predecessor still serves while its replacement dials.\n\t\tif (!this.#draining) this.status.set(\"connecting\");\n\n\t\t// This run's teardown, handed to connect() so a rerun cancels the attempt in flight.\n\t\tconst signal = effect.abort;\n\n\t\t// The session this run serves, closed with the run. A drained one leaves this slot\n\t\t// for #draining, which outlives the run.\n\t\tlet current: Established | undefined;\n\t\teffect.cleanup(() => {\n\t\t\tif (current) {\n\t\t\t\tcurrent.close();\n\t\t\t\tif (this.established.peek() === current) this.established.set(undefined);\n\t\t\t\tcurrent = undefined;\n\t\t\t}\n\t\t\tif (this.established.peek() === undefined) this.status.set(\"disconnected\");\n\t\t});\n\n\t\teffect.spawn(async () => {\n\t\t\t// Set once the session is live, so #retry can tell a healthy session that\n\t\t\t// later dropped from a connect failure or a peer that flaps immediately.\n\t\t\tlet connected: DOMHighResTimeStamp | undefined;\n\n\t\t\ttry {\n\t\t\t\t// Loops only to migrate: a GOAWAY off a healthy session dials its replacement\n\t\t\t\t// straight away, with no backoff.\n\t\t\t\tfor (;;) {\n\t\t\t\t\tconst dialing = this.#redirect.peek() ?? url;\n\n\t\t\t\t\tthis.#dialing = true;\n\t\t\t\t\tlet connection: Established;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconnection = await connect({\n\t\t\t\t\t\t\turl: dialing,\n\t\t\t\t\t\t\t// A redirect names the relay; a fallback URL pinned for the old one does not follow.\n\t\t\t\t\t\t\twebsocket: this.#redirect.peek() ? { ...this.websocket, url: undefined } : this.websocket,\n\t\t\t\t\t\t\twebtransport: this.webtransport,\n\t\t\t\t\t\t\tdiscovery: this.discovery,\n\t\t\t\t\t\t\tpublish: this.publish,\n\t\t\t\t\t\t\tconsume: this.consume,\n\t\t\t\t\t\t\tsignal,\n\t\t\t\t\t\t});\n\t\t\t\t\t} finally {\n\t\t\t\t\t\tthis.#dialing = false;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Hand the connection to the effect, which closes it now if this run is already over.\n\t\t\t\t\tif (signal.aborted) {\n\t\t\t\t\t\tconnection.close();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tcurrent = connection;\n\n\t\t\t\t\t// The replacement serves now; a predecessor keeps draining its groups in flight.\n\t\t\t\t\tthis.established.set(connection);\n\t\t\t\t\tthis.status.set(\"connected\");\n\t\t\t\t\tconnected = performance.now();\n\n\t\t\t\t\t// A cancelled effect resolves undefined, so the sentinel tells the session\n\t\t\t\t\t// closing (null for clean, an Error otherwise) apart from this run being\n\t\t\t\t\t// torn down. Anything else is the peer's GOAWAY.\n\t\t\t\t\tconst ended = await effect.race(connection.closed, wireOf(connection).goaway);\n\t\t\t\t\tif (ended === undefined) return;\n\t\t\t\t\tif (ended === null || ended instanceof Error) {\n\t\t\t\t\t\tconsole.warn(\"connection closed, reconnecting\");\n\t\t\t\t\t\tif (this.established.peek() === connection) this.established.set(undefined);\n\t\t\t\t\t\tthis.#retry(effect, connected, ended ?? undefined);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tcurrent = undefined;\n\t\t\t\t\t// A pinned WebSocket URL can win the race against the primary. Judge the\n\t\t\t\t\t// redirect against that endpoint, not the primary we never reached.\n\t\t\t\t\tconst socket = this.#redirect.peek() ? undefined : this.websocket?.url;\n\t\t\t\t\tif (!this.#migrate(connection, dialed(dialing, connection.transport, socket), ended)) return;\n\n\t\t\t\t\t// A session that outlived the initial delay was healthy, so its handover is not a\n\t\t\t\t\t// failure. One redirected almost at once still migrates, but through the backoff,\n\t\t\t\t\t// so two peers bouncing us between them escalate and eventually give up.\n\t\t\t\t\tif (performance.now() - connected < this.#initial()) {\n\t\t\t\t\t\tthis.#retry(effect, connected, new Error(\"peer redirected immediately\"));\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tthis.#delay = undefined;\n\t\t\t\t\tthis.#deadline = undefined;\n\t\t\t\t}\n\t\t\t} catch (err) {\n\t\t\t\t// Treat teardown as cancellation, not a connection failure.\n\t\t\t\tif (signal.aborted) return;\n\n\t\t\t\tconsole.warn(\"connection error:\", err);\n\t\t\t\tthis.#retry(effect, connected, err);\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Act on the peer's GOAWAY for `connection`, which was dialed at `dialing`: resolve where\n\t * to go next and leave the old session serving until it drains. Returns false when the\n\t * redirect is refused, which ends the sequence rather than redialing.\n\t */\n\t#migrate(connection: Established, dialing: URL, drain: Drain): boolean {\n\t\tconst hashes = this.webtransport?.serverCertificateHashes?.length ?? 0;\n\t\tconst configured = hashes > 0 || this.webtransport?.serverCertificate !== undefined;\n\t\t// The pin is a WebTransport option. A WebSocket that won the race never used it.\n\t\tconst pinned = pinnedTransport(connection.transport, configured);\n\n\t\tlet next: URL | undefined;\n\t\ttry {\n\t\t\tnext = target(this.goaway.redirect ?? \"same-host\", drain.uri, dialing, pinned);\n\t\t} catch (err) {\n\t\t\t// The peer is leaving and named somewhere we won't go: redialing the old address\n\t\t\t// would ignore it, so stop here.\n\t\t\tconsole.warn(\"GOAWAY redirect refused:\", err);\n\t\t\tconnection.close();\n\t\t\tthis.established.set(undefined);\n\t\t\tthis.status.set(\"disconnected\");\n\t\t\tthis.#giveUp(error(err));\n\t\t\treturn false;\n\t\t}\n\n\t\t// Only an accepted redirect replaces the URL; an empty one keeps it.\n\t\tif (next) {\n\t\t\tthis.#redirect.set(next);\n\t\t\tthis.#redirectHref = this.#sequenceHref;\n\t\t}\n\n\t\tconsole.info(\"GOAWAY received; migrating\");\n\t\t// A newer GOAWAY retires an older predecessor rather than holding two open.\n\t\tthis.#draining?.retire();\n\t\tconst cap = handover(this.goaway.handover ?? DEFAULT_HANDOVER, drain.timeout);\n\t\tconst draining = new Draining(connection, cap, () => {\n\t\t\tif (this.#draining === draining) this.#draining = undefined;\n\t\t\t// If nothing replaced it yet, nothing is serving.\n\t\t\tif (this.established.peek() !== connection) return;\n\t\t\tthis.established.set(undefined);\n\t\t\tthis.status.set(this.#dialing ? \"connecting\" : \"disconnected\");\n\t\t});\n\t\tthis.#draining = draining;\n\t\treturn true;\n\t}\n\n\t#initial(): Time.Milli {\n\t\treturn this.delay?.initial ?? DEFAULT_DELAY.initial;\n\t}\n\n\t/**\n\t * Schedule the next connect attempt after the current backoff, or stop once the retry window\n\t * has expired. `connected` is when the dead session was established, if it ever was, and\n\t * `cause` the error that killed it, if it died with one.\n\t */\n\t#retry(effect: Effect, connected: DOMHighResTimeStamp | undefined, cause?: unknown): void {\n\t\t// Resolved per sequence rather than at construction, so an edit to `delay` (including\n\t\t// one that drops a field back to its default) applies to the next retry. Field by\n\t\t// field rather than by spread: a caller building `{ initial: maybeInitial }` from an\n\t\t// optional value passes an explicit undefined, which a spread would take as the\n\t\t// answer, turning the backoff into NaN or the window into forever.\n\t\tconst delay = this.delay ?? {};\n\t\tconst initial = this.#initial();\n\t\tconst multiplier = delay.multiplier ?? DEFAULT_DELAY.multiplier;\n\t\tconst max = delay.max ?? DEFAULT_DELAY.max;\n\t\tconst timeout = delay.timeout ?? DEFAULT_DELAY.timeout;\n\n\t\t// Report disconnected during the backoff rather than when the retry reruns the\n\t\t// effect, unless a drained predecessor still serves until it retires.\n\t\tif (this.established.peek() === undefined) this.status.set(\"disconnected\");\n\n\t\t// A session that outlived the initial delay was healthy, so clear the backoff and\n\t\t// start a fresh retry window: a one-off drop should reconnect promptly. Anything\n\t\t// shorter is a peer that accepts and immediately severs, which has to keep\n\t\t// escalating or we hammer it forever at the initial delay.\n\t\tif (connected !== undefined && performance.now() - connected >= initial) {\n\t\t\tthis.#delay = undefined;\n\t\t\tthis.#deadline = undefined;\n\t\t}\n\n\t\t// An auth rejection stops this URL however long the session lived. UNAUTHORIZED is a\n\t\t// specified code rather than one we guessed at, so this is the peer saying these\n\t\t// credentials will never work; retrying them just burns the window. Matches\n\t\t// moq-tokio's reconnect loop, which stops on the same close. A new URL or a\n\t\t// disable/re-enable starts another sequence; the handle itself is not disposed.\n\t\t//\n\t\t// Only a session close says that. The stream registry gives 2 to DELIVERY_TIMEOUT,\n\t\t// so a stream reset during the SETUP exchange would otherwise suppress reconnect\n\t\t// for good.\n\t\tif (cause instanceof SessionError && cause.code === SessionCode.Unauthorized) {\n\t\t\tconsole.warn(\"session rejected as unauthorized, not retrying\");\n\t\t\tthis.#giveUp(cause);\n\t\t\treturn;\n\t\t}\n\n\t\tconst now = performance.now();\n\t\tthis.#delay ??= initial;\n\t\tthis.#deadline ??= timeout > 0 ? now + timeout : Number.POSITIVE_INFINITY;\n\n\t\tif (now >= this.#deadline) {\n\t\t\tconsole.warn(\"reconnect timed out\");\n\t\t\t// A graceful close has no error, so report the timeout itself.\n\t\t\tthis.#giveUp(cause === undefined ? new Error(\"reconnect timed out\") : error(cause));\n\t\t\treturn;\n\t\t}\n\n\t\t// Equal jitter, so a fleet of tabs knocked offline together doesn't reconnect on the same\n\t\t// tick, and never past the deadline the retry window promised.\n\t\tconst wait = Math.min(this.#delay * (0.5 + Math.random() / 2), this.#deadline - now);\n\t\tthis.#delay = Math.min(this.#delay * multiplier, max);\n\n\t\tconst tick = this.#tick.peek() + 1;\n\t\teffect.timer(() => this.#tick.update((prev) => Math.max(prev, tick)), wait);\n\t}\n\n\t#giveUp(cause: Error): void {\n\t\tthis.#error.set(cause);\n\t\tthis.#givenUpHref = this.#sequenceHref;\n\t\tthis.#resetSequence();\n\t}\n\n\t#resetSequence(): void {\n\t\tthis.#delay = undefined;\n\t\tthis.#deadline = undefined;\n\t\tthis.#sequenceHref = undefined;\n\t\tthis.#draining?.retire();\n\t}\n\n\t/**\n\t * Subscribe to broadcast announcements matching `scope`, spanning reconnects.\n\t *\n\t * The same {@link Announce.Consumer} stream as {@link Established.announced}, but everything active\n\t * is retracted (a `retracted` update) whenever the connection drops and re-announced on\n\t * reconnect, so a consumer draining `next()` never clings to a dead route across a reconnect.\n\t *\n\t * Stays empty while the relay lacks {@link Established.discovery}.\n\t */\n\tannounced(scope: Path.Pattern = Path.Pattern.all(), options?: Announce.Options): Announce.Consumer {\n\t\t// With a consume origin the table already spans reconnects (the forwarder retracts\n\t\t// a dead session's entries), so its stream is the same thing with less machinery.\n\t\tif (this.consume) return this.consume.announced(scope, options);\n\n\t\tconst producer = new Announce.Producer();\n\t\tconst consumer = producer.consume();\n\n\t\tconst pump = new Effect();\n\t\tpump.run((effect) => {\n\t\t\tconst conn = effect.get(this.established);\n\t\t\tif (!conn) return;\n\n\t\t\t// Without discovery the upstream announce stream never yields, so leave the\n\t\t\t// consumer empty rather than opening a subscription that can't be answered.\n\t\t\tif (!conn.discovery) return;\n\n\t\t\tconst upstream = conn.announced(scope, options);\n\t\t\teffect.cleanup(() => upstream.close());\n\n\t\t\t// Track what this connection announced so we can retract it if the connection\n\t\t\t// drops; the last event rides along for the retraction.\n\t\t\tconst active = new Map<Path.Valid, Announce.Update>();\n\n\t\t\teffect.spawn(async () => {\n\t\t\t\ttry {\n\t\t\t\t\tfor (;;) {\n\t\t\t\t\t\tconst entry = await effect.race(upstream.next());\n\t\t\t\t\t\tif (!entry) break;\n\t\t\t\t\t\tif (Announce.isActive(entry.kind)) active.set(entry.prefix, entry);\n\t\t\t\t\t\telse active.delete(entry.prefix);\n\t\t\t\t\t\tproducer.append(entry);\n\t\t\t\t\t}\n\t\t\t\t} catch {\n\t\t\t\t\t// A dropped connection resets the announce stream; the retractions below cover it.\n\t\t\t\t} finally {\n\t\t\t\t\t// Retract everything from the connection that just went away, so a per-broadcast\n\t\t\t\t\t// watcher tears down instead of clinging to the dead route.\n\t\t\t\t\tif (consumer.closed.peek() === undefined) {\n\t\t\t\t\t\tfor (const entry of active.values()) {\n\t\t\t\t\t\t\tproducer.append({ ...entry, kind: \"retracted\" });\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\n\t\tthis.#signals.cleanup(() => pump.close());\n\t\tvoid consumer.closed.then(() => pump.close());\n\n\t\treturn consumer;\n\t}\n\n\t/**\n\t * Snapshot the live connection's transport counters, or undefined while disconnected.\n\t * See {@link Established.stats}.\n\t */\n\tasync stats(): Promise<Stats | undefined> {\n\t\treturn this.established.peek()?.stats();\n\t}\n\n\t/** Stop reconnecting, close the current connection, and settle {@link Reload.closed}. Idempotent. */\n\tclose(abort?: Error) {\n\t\tthis.#signals.close();\n\t\tthis.#draining?.retire();\n\t\tif (this.#closed.peek() === undefined) this.#closed.set(abort ?? null);\n\t}\n}\n\n/**\n * A session the peer sent GOAWAY on, left serving so its groups in flight finish. It retires\n * when it closes on its own or overstays its handover window, and `onRetire` runs once either way.\n */\nclass Draining {\n\t#connection: Established;\n\t#timer: ReturnType<typeof setTimeout>;\n\t#onRetire: () => void;\n\t#retired = false;\n\n\tconstructor(connection: Established, handover: Time.Milli, onRetire: () => void) {\n\t\tthis.#connection = connection;\n\t\tthis.#onRetire = onRetire;\n\t\tthis.#timer = setTimeout(() => {\n\t\t\tconsole.warn(\"old session did not drain in time; closing\");\n\t\t\tthis.retire();\n\t\t}, handover);\n\t\tvoid connection.closed.then(() => this.retire());\n\t}\n\n\t/** Close the old session now, whatever remains of its window. Idempotent. */\n\tretire(): void {\n\t\tif (this.#retired) return;\n\t\tthis.#retired = true;\n\t\tclearTimeout(this.#timer);\n\t\tthis.#connection.close();\n\t\tthis.#onRetire();\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"reload.js","sourceRoot":"","sources":["../../src/connection/reload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAgB,GAAG,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAgC,IAAI,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAE3F,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAG5D,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAEN,SAAS,EACT,iBAAiB,EACjB,OAAO,EACP,SAAS,GAGT,MAAM,cAAc,CAAC;AACtB,OAAO,EAAe,KAAK,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,KAAK,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AAK,IAAI,CAAC,CAAC;YAChB,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;QAChB,CAAC;QACD,OAAO,IAAI,CAAC,KAAK,CAAC;IACnB,CAAC;IAED,uBAAuB;IACvB,KAAK;QACJ,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC;QACvB,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;QACf,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;QACf,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACpB,CAAC;CACD","sourcesContent":["import { Duration, type Instant, now, sleep } from \"@moq/clock\";\nimport { Derived, Effect, type GetPromise, type Getter, Once, Signal } from \"@moq/signals\";\nimport type * as Announce from \"../announced.ts\";\nimport { Handle as AuthHandle } from \"../auth.ts\";\nimport { ended } from \"../auth_session.ts\";\nimport { Allocator, reserved, Viewers } from \"../bandwidth.ts\";\nimport { ConnectTimeout, error, reason } from \"../error.ts\";\nimport type { Cost } from \"../hop.ts\";\nimport type { Consumer as OriginConsumer, Producer as OriginProducer } from \"../origin.ts\";\nimport * as Path from \"../path.ts\";\nimport { Follow, Observed } from \"../util/observed.ts\";\nimport { after } from \"../util/timer.ts\";\nimport { wireOf } from \"../wire.ts\";\nimport { webTransportDialed } from \"./browser.ts\";\nimport {\n\ttype ConnectProps,\n\testablish,\n\tnormalizeVersions,\n\tReached,\n\treachable,\n\ttype WebSocketProps,\n\ttype WebTransportProps,\n} from \"./connect.ts\";\nimport { type Answer, Dials } from \"./dials.ts\";\nimport { parse } from \"./endpoint.ts\";\nimport { DISCOVERY_REMOVED } from \"./forward.ts\";\nimport { DEFAULT_HANDOVER, dialed, type Goaway, type Handover, handover, pinnedTransport, target } from \"./goaway.ts\";\nimport { checkCost, connectTimeout } from \"./handshake.ts\";\nimport type { Session } from \"./session.ts\";\nimport { estimates, type Probe, type Sample } from \"./stats.ts\";\nimport { tick } from \"./ticker.ts\";\nimport { heldOf, Verdict } from \"./tokens.ts\";\n\n/**\n * The wait before a session on the WebSocket fallback first probes WebTransport, before jitter.\n * Each failed probe doubles it, up to {@link PROBE_MAX}, matching moq-tokio.\n */\nconst PROBE_INITIAL = Duration.secs(10);\n\n/** The longest wait between WebTransport probes, before jitter. */\nconst PROBE_MAX = Duration.secs(300);\n\n/** A dial's signed tokens and the connect timeout they left it, or the app's refusal. */\ntype Signed = { tokens: readonly string[]; left: Duration | null } | Extract<Answer, { refused: Error }>;\n\n/**\n * Exponential backoff settings for the reconnect loop.\n *\n * The delays carry jitter, so a fleet of tabs knocked offline together doesn't reconnect in\n * lockstep. Nothing retries until a session to the current URL has been established: the peer\n * accepts the connection credential (its SETUP, or on moq-lite-07 the AUTH_OK to the\n * connection's own credential) or drains the session with a GOAWAY, which no refusal sends. On\n * moq-lite 03/04, which answer the credential with nothing, staying up past\n * {@link Backoff.healthy} establishes it too; a version with an answer waits for it however long\n * the session stays up. An attempt failing, or a session closing sooner, stops that\n * URL with its error. That covers a relay refusing a live session, as it does a rejected token\n * on moq-lite 03 or later. After that, every failure is retried,\n * including an attempt that outlives {@link ConnectProps.timeout}, until\n * {@link Backoff.timeout} runs out, whatever the error, an auth rejection included; only a\n * refused GOAWAY redirect stops the current URL sooner. A new URL or a disable/re-enable starts another sequence.\n * Tokens from {@link Dials} fail fast the same way, with the failure on the connection's `error`\n * rather than a dial; once a session was established, each redial asks the app, which reads why\n * the last one failed on {@link Dial.failure} and stops the URL by failing the dial.\n *\n * A GOAWAY off a session that outlived {@link Backoff.healthy} migrates at once, unless it\n * sends the connection back to an endpoint that already redirected it elsewhere and the\n * session lived less than {@link Backoff.max} (or {@link Backoff.healthy} when\n * uncapped). Two peers redirecting to each other thus\n * wait out this backoff and count against the timeout.\n */\nexport type Backoff = {\n\t/** The delay before reconnecting (default: 1000ms; zero retries at once). */\n\tinitial?: Duration;\n\n\t/** The multiplier for the delay after each failure (default: 2; below 1 keeps it constant). */\n\tmultiplier?: number;\n\n\t/**\n\t * The maximum delay (default: 5000ms; `null` leaves it uncapped; zero retries at once). A cap\n\t * below `initial` caps the first delay too.\n\t */\n\tmax?: Duration | null;\n\n\t/**\n\t * How long a session must stay up to count as healthy (default: 1000ms; must be positive).\n\t *\n\t * Where the peer never answers the connection credential, as on moq-lite 03/04, the first\n\t * healthy session establishes the URL. Elsewhere only the peer's answer or a GOAWAY does,\n\t * however long a session stays up.\n\t * A healthy session's end resets the delay and the timeout. One that ends sooner is a\n\t * failed attempt, so a peer that accepts and then drops every session still escalates the\n\t * delay and exhausts the timeout.\n\t */\n\thealthy?: Duration;\n\n\t/**\n\t * Maximum total time to spend retrying the current URL before giving up\n\t * (default: `null`, unlimited; zero gives up at the first failure). Counts from the first dial, and restarts after a healthy session\n\t * outside a redirect loop, a URL change, or a disable/re-enable. It decides whether another\n\t * attempt starts and never cuts one that is running, so giving up can take up to one attempt\n\t * longer than the window; {@link ConnectProps.timeout} bounds each attempt. A peer that\n\t * restarts, draining each session with a GOAWAY naming no URI, restarts it too.\n\t */\n\ttimeout?: Duration | null;\n};\n\n/**\n * Connection and retry options for {@link Reload}.\n *\n * {@link ConnectProps.transport} is excluded: a supplied session is good for exactly one\n * connection, so the reconnect loop has nothing to reuse once that session drops. Call\n * {@link connect} directly when you have a session to hand over. Every attempt advertises\n * the default {@link ConnectProps.implementation}.\n *\n * @internal\n */\nexport type ReloadProps = Omit<\n\tConnectProps,\n\t\"url\" | \"signal\" | \"transport\" | \"implementation\" | \"tokens\" | \"viewers\"\n> & {\n\t/**\n\t * See {@link ConnectProps.tokens}; pass a `Signal` to replace them before they expire, or\n\t * {@link Dials} to sign a set for each dial when it starts.\n\t */\n\ttokens?: readonly string[] | Signal<readonly string[]> | Dials;\n\n\t/** A reload owns the abort signal for each connection attempt. */\n\tsignal?: never;\n\n\t/** A one-shot transport cannot be reused by the reconnect loop. */\n\ttransport?: never;\n\n\t/** A reload owns its {@link Reload.viewers}, fed by its own sessions' estimates. */\n\tviewers?: never;\n\n\t/** Whether to reload the connection when it disconnects (default: true). */\n\tenabled?: boolean | Signal<boolean>;\n\n\t/** The URL of the relay server. */\n\turl?: URL | Signal<URL | undefined>;\n\n\t/** Backoff settings for the reconnect loop; every field falls back to its default. */\n\tbackoff?: Backoff;\n\n\t/** How to react to the peer's GOAWAY; every field falls back to its default. */\n\tgoaway?: Handover;\n};\n\n/**\n * The backoff applied to whichever {@link Backoff} fields a caller leaves out.\n *\n * Retries are unlimited by default: a loop that gives up stays offline until something\n * redials it, and a page usually has nothing that will, so an outage of any length has to\n * recover on its own. {@link Reload.status} already shows the outage. A caller that can react\n * sets a timeout to surface a persistent failure on {@link Reload.error}; giving up does not\n * dispose the loop, and a new URL or a disable/re-enable starts another sequence.\n */\nconst DEFAULT_BACKOFF: Required<Backoff> = {\n\tinitial: Duration.millis(1000),\n\tmultiplier: 2,\n\tmax: Duration.millis(5000),\n\thealthy: Duration.millis(1000),\n\ttimeout: null,\n};\n\n/**\n * {@link Backoff} resolved against its defaults, with the same meaning as moq-tokio's\n * backoff. Throws a RangeError for a value that has none.\n *\n * Field by field rather than by spread: a caller building `{ initial: maybeInitial }` from an\n * optional value passes an explicit undefined, which a spread would take as the answer.\n */\nfunction pacing(backoff: Backoff) {\n\tconst initial = backoff.initial ?? DEFAULT_BACKOFF.initial;\n\t// `null` means no bound, so only `undefined` takes the default.\n\tconst cap = backoff.max === undefined ? DEFAULT_BACKOFF.max : backoff.max;\n\tconst multiplier = backoff.multiplier ?? DEFAULT_BACKOFF.multiplier;\n\tif (!Number.isFinite(multiplier)) throw new RangeError(`invalid backoff.multiplier: ${multiplier}`);\n\t// Zero would count every session as healthy, resetting the retry window forever under a\n\t// peer that drops each one on sight.\n\tconst healthy = backoff.healthy ?? DEFAULT_BACKOFF.healthy;\n\tif (healthy.isZero()) throw new RangeError(\"backoff.healthy must be positive\");\n\tconst timeout = backoff.timeout === undefined ? DEFAULT_BACKOFF.timeout : backoff.timeout;\n\t// A multiplier below 1 means no growth, not a delay that shrinks to nothing.\n\tconst growth = Math.max(multiplier, 1);\n\n\treturn {\n\t\tinitial: cap === null ? initial : initial.min(cap),\n\t\thealthy,\n\t\ttimeout,\n\t\t// How long a session must last to start a new run of redirects. One that outlived the\n\t\t// capped delay already redials no faster than the backoff would allow. Uncapped, the\n\t\t// healthy bar is the only rate the config names.\n\t\tsettled: cap ?? healthy,\n\t\t/** The delay after one that waited `delay`. */\n\t\tnext(delay: Duration): Duration {\n\t\t\tconst next = Math.min(delay.asNanos() * growth, cap?.asNanos() ?? Number.POSITIVE_INFINITY);\n\t\t\t// Saturates, as Rust's Duration does, rather than overflowing the wait.\n\t\t\treturn Number.isFinite(next) ? Duration.nanos(next) : delay;\n\t\t},\n\t};\n}\n\n/** How often the send-rate estimate is sampled from the live transport while a reservation reads it. */\nconst BANDWIDTH_POLL = Duration.millis(100);\n\n/** Current state of a reconnecting connection. */\nexport type ReloadStatus = \"connecting\" | \"connected\" | \"disconnected\";\n\n/**\n * The reconnect loop behind a Connection handle: connects, waits for the session to end, then\n * redials with exponential backoff.\n *\n * The first attempt for a URL fails fast instead: until a session to it was established (see\n * {@link Backoff}), a failed attempt or a closed session sets {@link Reload.error}\n * rather than retrying, so a setup mistake such as an\n * untrusted certificate or no version in common surfaces at once. A page opened before its\n * relay is reachable therefore stays disconnected until a new URL or a disable/re-enable,\n * {@link Dials} included.\n *\n * @internal\n */\nexport class Reload {\n\t/** Relay URL to connect to; updating it triggers a reconnect. */\n\turl: Signal<URL | undefined>;\n\n\t/** Whether reconnecting is active. */\n\tenabled: Signal<boolean>;\n\n\t/**\n\t * Credentials every dial presents; see {@link ConnectProps.tokens}. Replacing them reaches\n\t * the next dial and, on a live session with AUTH, presents the new tokens at once,\n\t * withdrawing the replaced ones once every new one has its answer. With {@link Dials}, the set\n\t * the latest dial signed, which only that dial presents.\n\t */\n\ttokens: Signal<readonly string[]>;\n\n\t// Where each dial asks for its tokens, instead of reading `tokens`.\n\treadonly #dials?: Dials;\n\t/**\n\t * Why the loop is retrying: how the last attempt or session ended since a session last served,\n\t * or undefined. The next {@link Dials} dial reads it. Mirrors Rust's `Monitor::failure()`.\n\t */\n\treadonly failure: Getter<Error | undefined>;\n\treadonly #failure = new Signal<Error | undefined>(undefined);\n\n\t/**\n\t * Current connection status. A session reads as connected only once its peer accepts the\n\t * credential (on moq-lite-03/04, which never answer it, once it stays up past the healthy\n\t * bar), so a refused one never does.\n\t */\n\tstatus = new Signal<ReloadStatus>(\"disconnected\");\n\n\t/**\n\t * The failure that stopped retrying the current URL, or undefined while the loop is live.\n\t *\n\t * Set when the first attempt for a URL fails, or when the retry window\n\t * expires. Cleared when a new URL or a\n\t * disable/re-enable starts another sequence, not on a page hide/show. Transient drops\n\t * that are still being retried leave this empty.\n\t */\n\treadonly error: Getter<Error | undefined>;\n\n\t/** The currently established session, or undefined while disconnected. */\n\testablished = new Signal<Session | undefined>(undefined);\n\n\t/**\n\t * The current connection's PROBE estimates, spanning reconnects.\n\t *\n\t * Undefined while disconnected: the estimates belong to a single connection.\n\t * Observation requests updates; `peek()` alone is passive.\n\t * See {@link Session.probe}.\n\t */\n\treadonly probe: Getter<Probe | undefined>;\n\t#probeSource = new Signal<Getter<Probe> | undefined>(undefined);\n\n\t/**\n\t * Divides this connection's send-rate estimate among the tracks sharing it.\n\t *\n\t * The same identity across reconnects, so reservations survive a drop. The\n\t * estimate is `undefined` while disconnected, which tells a sender to hold\n\t * its rate rather than encode at zero. It is sampled from the transport only\n\t * while a reservation reads it, so the first reservation after none waits one\n\t * snapshot for its slice. It stays `undefined` on a transport that cannot\n\t * report one: the WebSocket fallback, WebTransport without\n\t * `getStats()`, or Safari's stub, which reads as none.\n\t */\n\treadonly allocator: Allocator;\n\n\t/**\n\t * Divides this connection's receive estimate among the broadcasts watched over it.\n\t *\n\t * The same identity across reconnects, so viewers survive a drop, and every session\n\t * the loop dials sends their ceilings summed as its PROBE target. A live viewer\n\t * requests PROBE; viewers report `undefined` while disconnected.\n\t */\n\treadonly viewers: Viewers;\n\n\t/**\n\t * The auth handle every session of the loop is built on, spanning reconnects.\n\t *\n\t * Each session presents every token it holds, so a route naming one keeps it across a\n\t * reconnect, and its grant follows the live session. It spans URL changes too, so its\n\t * tokens go to whatever URL the loop dials next. It ends once the loop closes and its\n\t * sessions finish draining, and aborting it stops the loop at its next reconnect, with the\n\t * abort's error.\n\t */\n\treadonly auth = new AuthHandle();\n\n\t// The peer's verdict on the latest tokens, across reconnects.\n\treadonly #verdict: Verdict;\n\n\t/** Protocol versions to offer, most preferred first, kept across retries and redirects. */\n\treadonly versions?: readonly string[];\n\n\t/** Whether the URL carries the connection credential as `auth` (not reactive); see {@link ConnectProps.urlAuth}. */\n\treadonly urlAuth?: boolean;\n\n\t/** WebTransport options applied to each connection attempt (not reactive). */\n\twebtransport?: WebTransportProps;\n\n\t/** WebSocket fallback options applied to each connection attempt (not reactive). */\n\twebsocket: WebSocketProps | undefined;\n\n\t/** The bound on each connection attempt, or `null` for none. See {@link ConnectProps.timeout}. */\n\treadonly timeout: Duration | null;\n\n\t/** The price of each session's link. See {@link ConnectProps.cost}. */\n\treadonly cost?: Cost;\n\n\t/**\n\t * The origin whose broadcasts are served, spanning reconnects (not reactive).\n\t *\n\t * Each session announces the origin's table when it attaches, so a broadcast published\n\t * while offline surfaces on the next connection and a reconnect re-announces everything\n\t * still published. See the `publish` connect option.\n\t */\n\tpublish?: OriginConsumer;\n\n\t/**\n\t * The origin fed with the peer's announced broadcasts, spanning reconnects (not\n\t * reactive).\n\t *\n\t * The entries a session fed retract when it dies, and the next session asks again for\n\t * whatever is still watched, so a consumer watching the origin sees offline/online\n\t * transitions across a reconnect. See the `consume` connect option.\n\t */\n\tconsume?: OriginProducer;\n\n\t/** Backoff settings for the reconnect loop; an unset field uses its default. */\n\tbackoff: Backoff;\n\n\t/** How to react to the peer's GOAWAY (not reactive). */\n\tgoaway: Handover;\n\n\t/**\n\t * The URL an accepted GOAWAY redirect assigned, or undefined while the loop dials\n\t * {@link Reload.url}. Sticky across reconnects: a redirect is an assignment, not a\n\t * detour. Cleared when a dial to it fails, so the redial returns to {@link Reload.url},\n\t * or when a new URL or a disable/re-enable starts another sequence.\n\t */\n\treadonly redirect: Getter<URL | undefined>;\n\n\t/** The reactive effect scope driving the connect loop; closed by {@link Reload.close}. */\n\t#signals = new Effect();\n\n\t// Sampled from the live session; undefined while disconnected or the transport has none.\n\treadonly #sample = new Observed<Sample | undefined>(undefined);\n\t/** The latest transport sample while a reporter or bandwidth reservation needs it. */\n\treadonly sample: Getter<Sample | undefined> = this.#sample;\n\t#estimate = new Signal<number | undefined>(undefined);\n\n\t/**\n\t * Settles once this loop is disposed via {@link Reload.close}: `null` on a clean close,\n\t * or the abort {@link Error}. Peek it synchronously (`undefined` while open), observe it\n\t * reactively, or `await` it. Attempt failures live on {@link Reload.error} instead.\n\t */\n\tget closed(): GetPromise<Error | null> {\n\t\treturn this.#closed;\n\t}\n\n\t#closed = new Once<Error | null>();\n\t#error = new Signal<Error | undefined>(undefined);\n\t#redirect = new Signal<URL | undefined>(undefined);\n\t// The configured href the redirect was assigned for.\n\t#redirectHref: string | undefined;\n\n\t// A session the peer sent GOAWAY on, serving its groups in flight while the replacement\n\t// dials. Retired when it closes, at its handover cap, or when the sequence ends.\n\t#draining: Draining | undefined;\n\t// A redirect from the draining fallback's peer, held while a replacement serves.\n\t#pending: { connection: Session; next: URL } | undefined;\n\n\t// Sessions this loop ended that are still draining, each until its close settles.\n\t#ending = new Map<Session, Promise<void>>();\n\n\t// The current run of migrations. A redirect back to an endpoint that already sent us away is\n\t// a loop, however healthy each session looked. Reset when a session ends without a GOAWAY,\n\t// outlives the capped delay, or a new sequence starts.\n\t#redirects = new Redirects();\n\n\t// Whether a run is dialing: from its start until each connect attempt settles.\n\t#dialing = false;\n\n\t// The current wait between attempts, doubling per failure, and when the retry window expires.\n\t// Both are undefined between sequences, so a later edit to `backoff` applies to the next one.\n\t#delay: Duration | undefined;\n\t// When the retry window expires, or null when it never does.\n\t#deadline: Instant | null | undefined;\n\n\t// The URL the current retry sequence is for. Cleared when disabled, URL-less, or given\n\t// up, so the next attempt starts a fresh backoff window.\n\t#sequenceHref: string | undefined;\n\n\t// The href that exhausted its retry sequence. Survives a page hide/show so resume does\n\t// not restart a sequence that already gave up. Cleared when the URL changes or the\n\t// loop is disabled.\n\t#givenUpHref: string | undefined;\n\n\t// The configured href a session's peer accepted the credential of or drained with a GOAWAY,\n\t// or a moq-lite-03/04 session stayed up past the healthy bar for. Until it matches, a failed\n\t// attempt or a closed session gives up rather than retrying. Kept across a page hide/show and a disable/re-enable, which\n\t// resume a URL that worked.\n\t#establishedHref: string | undefined;\n\n\t#tick = new Signal(0);\n\n\t// True after the browser freezes or hides the page until it visibly resumes.\n\t#suspended = new Signal(false);\n\t// Watches the page for #suspended, outliving the loop until the sessions it ended settle.\n\t#suspension = new Effect();\n\n\t// Use the serialized URL as the reactive connection key. URL objects use identity\n\t// equality, but replacing one with an equivalent instance should not reconnect.\n\t#url: Getter<string | undefined>;\n\tconstructor(props?: ReloadProps) {\n\t\tif (props && \"discovery\" in props) throw new TypeError(DISCOVERY_REMOVED);\n\t\tthis.url = Signal.from(props?.url);\n\t\tthis.enabled = Signal.from(props?.enabled ?? true);\n\t\tconst tokens = props?.tokens ?? [];\n\t\tthis.#dials = tokens instanceof Dials ? tokens : undefined;\n\t\tthis.tokens = Signal.from(tokens instanceof Dials ? [] : tokens);\n\t\tthis.#verdict = new Verdict(this.tokens, this.auth);\n\t\tthis.backoff = props?.backoff ?? {};\n\t\t// Validated here, like the timeout, rather than by every retry.\n\t\tpacing(this.backoff);\n\t\tthis.goaway = props?.goaway ?? {};\n\t\tthis.redirect = this.#redirect;\n\t\tthis.versions = normalizeVersions(props);\n\t\tthis.urlAuth = props?.urlAuth;\n\t\tthis.webtransport = props?.webtransport;\n\t\tthis.websocket = props?.websocket;\n\t\t// Validated here, like the versions, rather than by every attempt.\n\t\tthis.timeout = connectTimeout(props?.timeout);\n\t\tcheckCost(props?.cost);\n\t\tthis.cost = props?.cost;\n\t\tthis.publish = props?.publish;\n\t\tthis.consume = props?.consume;\n\n\t\t// The consume origin's announcement streams are not synced while no session is there to\n\t\t// deliver an initial set, so an empty table before the first connect, or during a\n\t\t// reconnect, never reads as nothing being announced. The next session takes its own\n\t\t// hold before this one is released. Taken now rather than in the effect, which runs\n\t\t// a microtask later, after a watcher created alongside would already have synced.\n\t\tif (this.consume) {\n\t\t\tconst consume = wireOf(this.consume);\n\t\t\tlet hold = this.enabled.peek() ? consume.snapshot(Path.empty()) : undefined;\n\t\t\tthis.#signals.run((effect) => {\n\t\t\t\tif (effect.get(this.enabled) && !effect.get(this.established)) {\n\t\t\t\t\thold ??= consume.snapshot(Path.empty());\n\t\t\t\t} else {\n\t\t\t\t\thold?.();\n\t\t\t\t\thold = undefined;\n\t\t\t\t}\n\t\t\t});\n\t\t\tthis.#signals.cleanup(() => hold?.());\n\t\t}\n\n\t\tthis.error = this.#error;\n\t\tthis.failure = this.#failure;\n\n\t\tconst win = globalThis.window;\n\t\tconst doc = globalThis.document;\n\t\tif (typeof win !== \"undefined\" && typeof doc !== \"undefined\") {\n\t\t\tthis.#suspension.event(win, \"pagehide\", () => this.#suspended.set(true));\n\t\t\tthis.#suspension.event(win, \"pageshow\", () => this.#suspended.set(false));\n\t\t\tthis.#suspension.event(win, \"unload\", () => this.#suspended.set(true));\n\t\t\tthis.#suspension.event(doc, \"visibilitychange\", () => {\n\t\t\t\tif (!doc.hidden) this.#suspended.set(false);\n\t\t\t});\n\t\t\t// Nothing would run to finish a drain begun before the page went away either.\n\t\t\tthis.#suspension.run((effect) => {\n\t\t\t\tif (!effect.get(this.#suspended)) return;\n\t\t\t\tfor (const connection of this.#ending.keys()) connection.abort();\n\t\t\t\tthis.#ending.clear();\n\t\t\t});\n\t\t}\n\n\t\tthis.probe = new Follow(this.#probeSource);\n\t\tthis.#signals.run((effect) => {\n\t\t\teffect.set(this.#probeSource, effect.get(this.established)?.probe, undefined);\n\t\t});\n\n\t\tthis.allocator = new Allocator(this.#estimate);\n\t\tthis.#signals.cleanup(() => this.allocator.close());\n\n\t\t// Lazy: the registry observes the estimate only while a viewer is live, and only\n\t\t// that observation requests PROBE from the current session.\n\t\tthis.viewers = new Viewers(new Derived([this.probe], (probe) => probe?.estimatedRecvRate));\n\t\tthis.#signals.cleanup(() => this.viewers.close());\n\n\t\t// Share the allocator's poll with report readers. Skip an overlapping request, and\n\t\t// clear the sample when the session changes or the last consumer leaves.\n\t\tthis.#signals.run((effect) => {\n\t\t\teffect.set(this.#estimate, undefined);\n\t\t\teffect.set(this.#sample, undefined);\n\t\t\tif (!effect.get(reserved(this.allocator)) && !effect.get(this.#sample.wanted)) return;\n\t\t\tconst connection = effect.get(this.established);\n\t\t\tif (!connection || !estimates(connection)) return;\n\n\t\t\tlet pending = false;\n\t\t\tconst sample = async () => {\n\t\t\t\tif (pending) return;\n\t\t\t\tpending = true;\n\t\t\t\ttry {\n\t\t\t\t\tconst at = now();\n\t\t\t\t\tconst stats = await effect.race([connection.stats()]);\n\t\t\t\t\tif (stats) {\n\t\t\t\t\t\tthis.#sample.set({ ...stats, at });\n\t\t\t\t\t\tthis.#estimate.set(stats.estimatedSendRate);\n\t\t\t\t\t}\n\t\t\t\t} finally {\n\t\t\t\t\tpending = false;\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tvoid sample();\n\t\t\t// One page-wide ticker samples every connection in the same wakeup.\n\t\t\teffect.cleanup(tick(BANDWIDTH_POLL, () => void sample()));\n\t\t});\n\n\t\t// The live session holds the current tokens on AUTH; a dial picks them up itself.\n\t\tthis.#signals.run((effect) => {\n\t\t\tconst tokens = effect.get(this.tokens);\n\t\t\t// Before the held tokens change, so a token the set kept is judged by what it was.\n\t\t\tthis.#verdict.refresh();\n\t\t\t// A signed set belongs to its own dial: another session presenting it would spend it.\n\t\t\tif (this.#dials) return;\n\t\t\tconst connection = effect.get(this.established);\n\t\t\tif (connection) heldOf(connection)?.update(tokens);\n\t\t});\n\n\t\tthis.#url = this.#signals.computed((effect) => effect.get(this.url)?.href);\n\t\tthis.#signals.run(this.#connect.bind(this));\n\t}\n\n\t#connect(effect: Effect): void {\n\t\t// Will retry when the tick changes.\n\t\teffect.get(this.#tick);\n\n\t\tconst enabled = effect.get(this.enabled);\n\t\tif (!enabled) {\n\t\t\tthis.#givenUpHref = undefined;\n\t\t\tthis.#resetSequence();\n\t\t\tthis.#redirect.set(undefined);\n\t\t\treturn;\n\t\t}\n\n\t\t// Hide/freeze pauses an in-flight sequence without recovering from give-up.\n\t\tconst suspended = effect.get(this.#suspended);\n\t\tif (suspended) {\n\t\t\tthis.#resetSequence();\n\t\t\treturn;\n\t\t}\n\n\t\tconst href = effect.get(this.#url);\n\t\tif (!href) {\n\t\t\tthis.#givenUpHref = undefined;\n\t\t\tthis.#resetSequence();\n\t\t\tthis.#redirect.set(undefined);\n\t\t\treturn;\n\t\t}\n\t\tconst url = new URL(href);\n\n\t\tif (this.#givenUpHref === href) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this.#sequenceHref !== href) {\n\t\t\tthis.#resetSequence();\n\t\t\t// A redirect was assigned for another URL; this one starts from itself. A page\n\t\t\t// hide/show resumes the same URL, so it keeps the assignment.\n\t\t\tif (this.#redirectHref !== href) this.#redirect.set(undefined);\n\t\t\tthis.#sequenceHref = href;\n\t\t\tthis.#error.set(undefined);\n\t\t\tthis.#givenUpHref = undefined;\n\t\t}\n\n\t\tthis.#setDialing(true);\n\n\t\t// This run's teardown, handed to connect() so a rerun cancels the attempt in flight.\n\t\tconst signal = effect.abort;\n\n\t\t// The session this run serves, ended with the run. A drained one leaves this slot\n\t\t// for #draining, which outlives the run.\n\t\tlet current: Session | undefined;\n\t\t// Set once the session is live, so #retry can tell a healthy session that\n\t\t// later dropped from a connect failure or a peer that flaps immediately.\n\t\tlet connected: Instant | undefined;\n\t\teffect.cleanup(() => {\n\t\t\tif (current) {\n\t\t\t\t// A session torn down while live, as on a page hide, may already have earned it.\n\t\t\t\tif (connected !== undefined) this.#settle(href, current, connected);\n\t\t\t\tthis.#end(current);\n\t\t\t\tif (this.established.peek() === current) this.#serve(undefined);\n\t\t\t\tcurrent = undefined;\n\t\t\t}\n\t\t\tthis.#setDialing(false);\n\t\t});\n\n\t\teffect.spawn(async () => {\n\t\t\t// Whether the last failure was a dial to a GOAWAY redirect's target.\n\t\t\tlet redirectFailed = false;\n\n\t\t\ttry {\n\t\t\t\t// The WebTransport session a probe opened, which the next dial finishes its MoQ\n\t\t\t\t// handshake over instead of racing.\n\t\t\t\tlet reached: Reached | undefined;\n\t\t\t\t// Loops only to migrate: a GOAWAY off a healthy session dials its replacement\n\t\t\t\t// straight away, with no backoff.\n\t\t\t\tfor (;;) {\n\t\t\t\t\tconst dialing = this.#redirect.peek() ?? url;\n\t\t\t\t\t// The retry window counts from the first dial of a run, so a dial that hangs\n\t\t\t\t\t// spends it too.\n\t\t\t\t\tthis.#deadline ??= this.#window(now());\n\n\t\t\t\t\tthis.#setDialing(true);\n\t\t\t\t\tthis.#verdict.dialing();\n\t\t\t\t\tlet tokens = reached?.tokens;\n\t\t\t\t\t// Signing spends the attempt's own timeout, so a stuck signer fails like a slow dial.\n\t\t\t\t\tlet timeout = this.timeout;\n\t\t\t\t\tif (!tokens && this.#dials) {\n\t\t\t\t\t\tlet signed: Signed;\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tsigned = await this.#sign(this.#dials, dialing, signal, this.#failure.peek());\n\t\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\t\tthis.#setDialing(false);\n\t\t\t\t\t\t\t// A redirect's target left unanswered falls back to the URL, as one that failed does.\n\t\t\t\t\t\t\tredirectFailed = this.#redirect.peek() !== undefined;\n\t\t\t\t\t\t\tthrow err;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// A teardown that closed the dials is no refusal.\n\t\t\t\t\t\tif (signal.aborted) return;\n\t\t\t\t\t\tif (\"refused\" in signed) {\n\t\t\t\t\t\t\tthis.#setDialing(false);\n\t\t\t\t\t\t\tconsole.warn(\"dial refused by its signer, not retrying:\", signed.refused);\n\t\t\t\t\t\t\tthis.#giveUp(signed.refused);\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttokens = signed.tokens;\n\t\t\t\t\t\ttimeout = signed.left;\n\t\t\t\t\t}\n\t\t\t\t\ttokens ??= this.tokens.peek();\n\t\t\t\t\t// A probe's dial signed its own set too, which `answered()` judges from here.\n\t\t\t\t\tif (this.#dials) this.tokens.set(tokens);\n\t\t\t\t\tlet connection: Session;\n\t\t\t\t\tconst reusing = reached;\n\t\t\t\t\treached = undefined;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconnection = await establish(\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\turl: dialing,\n\t\t\t\t\t\t\t\ttokens,\n\t\t\t\t\t\t\t\turlAuth: this.urlAuth,\n\t\t\t\t\t\t\t\t// A redirect names the relay; a fallback URL pinned for the old one does not follow.\n\t\t\t\t\t\t\t\twebsocket: this.#redirect.peek()\n\t\t\t\t\t\t\t\t\t? { ...this.websocket, url: undefined }\n\t\t\t\t\t\t\t\t\t: this.websocket,\n\t\t\t\t\t\t\t\tversions: this.versions,\n\t\t\t\t\t\t\t\twebtransport: this.webtransport,\n\t\t\t\t\t\t\t\ttimeout,\n\t\t\t\t\t\t\t\tpublish: this.publish,\n\t\t\t\t\t\t\t\tconsume: this.consume,\n\t\t\t\t\t\t\t\tcost: this.cost,\n\t\t\t\t\t\t\t\tauth: this.auth,\n\t\t\t\t\t\t\t\tviewers: this.viewers,\n\t\t\t\t\t\t\t\tsignal,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\treusing,\n\t\t\t\t\t\t);\n\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\tthis.#setDialing(false);\n\t\t\t\t\t\tredirectFailed = this.#redirect.peek() !== undefined;\n\t\t\t\t\t\tthrow err;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Hand the connection to the effect. One that lands after this run is over never\n\t\t\t\t\t// served anything, so there is nothing to drain.\n\t\t\t\t\tif (signal.aborted) {\n\t\t\t\t\t\tconnection.abort();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tcurrent = connection;\n\t\t\t\t\tthis.#verdict.connected(connection);\n\t\t\t\t\tconnected = now();\n\n\t\t\t\t\t// Serve only once the session is established: the peer accepted its credential or\n\t\t\t\t\t// drained it with a GOAWAY. On a version that never answers (moq-lite-03/04),\n\t\t\t\t\t// staying up past the healthy bar is the only sign, so it counts there alone.\n\t\t\t\t\t// Until then it may still be a refusal, which never reads as connected. A close\n\t\t\t\t\t// first is handled below.\n\t\t\t\t\tconst auth = wireOf(connection).auth;\n\t\t\t\t\tconst bar = this.#pacing().healthy;\n\t\t\t\t\tconst acceptance = auth.accepted;\n\t\t\t\t\tif (!acceptance.peek()) {\n\t\t\t\t\t\tconst waiting = new AbortController();\n\t\t\t\t\t\tconst waits: unknown[] = [Signal.race(acceptance), connection.closed, connection.draining];\n\t\t\t\t\t\tif (auth.silent) waits.push(sleep(bar, { signal: waiting.signal }).catch(() => {}));\n\t\t\t\t\t\tawait effect.race(waits).finally(() => waiting.abort());\n\t\t\t\t\t\tif (signal.aborted) return;\n\t\t\t\t\t}\n\t\t\t\t\tif (\n\t\t\t\t\t\tacceptance.peek() ||\n\t\t\t\t\t\tconnection.draining.peek() !== undefined ||\n\t\t\t\t\t\t(auth.silent && now().since(connected).ge(bar))\n\t\t\t\t\t) {\n\t\t\t\t\t\t// The replacement serves now; a predecessor keeps draining its groups in flight.\n\t\t\t\t\t\tthis.#serve(connection);\n\t\t\t\t\t\tthis.#failure.set(undefined);\n\t\t\t\t\t}\n\t\t\t\t\tthis.#setDialing(false);\n\n\t\t\t\t\t// A cancelled effect resolves undefined, so the sentinel tells the session\n\t\t\t\t\t// closing (null for clean, an Error otherwise) apart from this run being\n\t\t\t\t\t// torn down. Anything else is the peer's GOAWAY, or WebTransport reachable\n\t\t\t\t\t// again under a session on the WebSocket fallback.\n\t\t\t\t\tconst probing = new AbortController();\n\t\t\t\t\tconst probe = this.#probe(connection, dialing, probing.signal);\n\t\t\t\t\tconst first = await effect\n\t\t\t\t\t\t.race([connection.closed, connection.draining, probe])\n\t\t\t\t\t\t.finally(() => probing.abort());\n\t\t\t\t\t// The peer's GOAWAY wins over a probe that got through in the same turn, so its\n\t\t\t\t\t// redirect is never lost.\n\t\t\t\t\tconst drain = connection.draining.peek();\n\t\t\t\t\tconst raced = first instanceof Reached && drain !== undefined ? drain : first;\n\t\t\t\t\t// A probe the race did not take still holds an open WebTransport session.\n\t\t\t\t\tvoid probe.then((left) => {\n\t\t\t\t\t\tif (left !== raced) left.transport.close();\n\t\t\t\t\t});\n\t\t\t\t\tif (raced === undefined) return;\n\t\t\t\t\t// Leaving the fallback is a GOAWAY of our own: the session drains as the\n\t\t\t\t\t// predecessor while the replacement finishes its handshake over the probe.\n\t\t\t\t\tif (raced instanceof Reached) {\n\t\t\t\t\t\tconsole.info(\"WebTransport reachable again; leaving the WebSocket fallback\");\n\t\t\t\t\t\twireOf(connection).leave();\n\t\t\t\t\t\treached = raced;\n\t\t\t\t\t}\n\t\t\t\t\tconst ended = raced instanceof Reached ? { uri: \"\" } : raced;\n\t\t\t\t\tthis.#settle(href, connection, connected);\n\t\t\t\t\tif (ended === null || ended instanceof Error) {\n\t\t\t\t\t\t// Until a session was established, a close stops the URL as a failed attempt\n\t\t\t\t\t\t// does: it is how a relay refuses a live session before accepting its credential.\n\t\t\t\t\t\t// No error kind is read.\n\t\t\t\t\t\tif (this.#establishedHref !== href) {\n\t\t\t\t\t\t\tconsole.warn(`connection closed, not retrying: ${ended ? reason(ended) : \"no error\"}`);\n\t\t\t\t\t\t\tcurrent = undefined;\n\t\t\t\t\t\t\tthis.#serve(undefined);\n\t\t\t\t\t\t\tthis.#giveUp(ended ?? new Error(\"connection closed\"));\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconsole.warn(`connection closed, reconnecting: ${ended ? reason(ended) : \"no error\"}`);\n\t\t\t\t\t\tthis.#redirects.reset();\n\t\t\t\t\t\tcurrent = undefined;\n\t\t\t\t\t\t// A predecessor still draining serves again, so this is no outage.\n\t\t\t\t\t\tif (this.established.peek() === connection) this.#serve(this.#draining?.serving());\n\t\t\t\t\t\tthis.#applyPending();\n\t\t\t\t\t\tthis.#retry(effect, connected, ended ?? undefined);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tcurrent = undefined;\n\t\t\t\t\t// A peer's GOAWAY establishes the URL however soon it came: the peer accepted the\n\t\t\t\t\t// session and asked us to move, which a refusal never does, so a page opened while\n\t\t\t\t\t// its relay drains rides out the restart. Leaving the fallback is our own.\n\t\t\t\t\tif (!reached) this.#establishedHref = href;\n\t\t\t\t\t// A pinned WebSocket URL can win the race against the primary. Judge the\n\t\t\t\t\t// redirect against that endpoint, not the primary we never reached.\n\t\t\t\t\tconst socket = this.#redirect.peek() ? undefined : this.websocket?.url;\n\t\t\t\t\tconst at = dialed(dialing, connection.transport, socket);\n\t\t\t\t\tconst before = this.#redirect.peek();\n\t\t\t\t\tif (!this.#migrate(connection, at, ended)) {\n\t\t\t\t\t\treached?.transport.close();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\t// Moving off the fallback is no peer's redirect or restart, and the probe\n\t\t\t\t\t// backoff already paces it, so its replacement dials at once. A fallback that\n\t\t\t\t\t// served past the healthy bar still earns the healthy reset.\n\t\t\t\t\tif (reached) {\n\t\t\t\t\t\tthis.#follow(connection, at, pinnedTransport(connection.transport, this.#pinned()), href);\n\t\t\t\t\t\tif (now().since(connected).ge(this.#pacing().healthy)) {\n\t\t\t\t\t\t\tthis.#delay = undefined;\n\t\t\t\t\t\t\tthis.#deadline = undefined;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tconst after = this.#redirect.peek();\n\n\t\t\t\t\t// Two peers that each hold a session past the healthy bar can still bounce us between\n\t\t\t\t\t// them forever. Returning to an endpoint that already sent us elsewhere in this\n\t\t\t\t\t// run of migrations escalates the backoff, which never resets mid-loop, so the\n\t\t\t\t\t// retry window still applies. A one-way rolling restart never revisits one, and\n\t\t\t\t\t// a GOAWAY back to the same place is a restart, not a move, so it never counts.\n\t\t\t\t\t// A session that outlived the capped delay already redials no faster than the\n\t\t\t\t\t// backoff would allow, so it starts a new run: rolling restarts days apart\n\t\t\t\t\t// never add up to a loop.\n\t\t\t\t\tconst { settled, healthy } = this.#pacing();\n\t\t\t\t\tconst lived = now().since(connected);\n\t\t\t\t\tif (lived.ge(settled)) this.#redirects.reset();\n\t\t\t\t\t// Only a redirect this GOAWAY named is a move. An empty or ignored one reconnects\n\t\t\t\t\t// in place, even when that reruns the race a WebSocket fallback won.\n\t\t\t\t\tconst from = destination(at);\n\t\t\t\t\tconst to = after && after !== before ? destination(after) : from;\n\t\t\t\t\tif (to !== from && this.#redirects.move(from, to)) {\n\t\t\t\t\t\tthis.#retry(effect, undefined, new Error(\"redirect loop\"));\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\t// A healthy session's handover is not a failure. One redirected sooner still\n\t\t\t\t\t// migrates, but through the backoff, so two peers bouncing us between them\n\t\t\t\t\t// escalate to the capped delay. An empty URI is a peer restarting, which drains\n\t\t\t\t\t// each new session until it goes; every one serves, so that is no failure either.\n\t\t\t\t\tif (lived.lt(healthy)) {\n\t\t\t\t\t\tif (ended.uri === \"\") this.#restart(effect);\n\t\t\t\t\t\telse this.#retry(effect, connected, new Error(\"peer redirected immediately\"));\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tthis.#delay = undefined;\n\t\t\t\t\tthis.#deadline = undefined;\n\t\t\t\t}\n\t\t\t} catch (err) {\n\t\t\t\tif (signal.aborted) return;\n\n\t\t\t\t// An ended auth handle refuses every later session, so no retry can recover.\n\t\t\t\tconst closed = ended(this.auth);\n\t\t\t\tif (closed) {\n\t\t\t\t\tthis.#giveUp(closed);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Attempts fail fast until a session was established: a URL whose peer never accepted\n\t\t\t\t// one is more likely misconfigured than restarting, and only the app can fix that.\n\t\t\t\tif (this.#establishedHref !== href) {\n\t\t\t\t\tconsole.warn(\"connection failed, not retrying:\", err);\n\t\t\t\t\tthis.#giveUp(error(err));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconsole.warn(\"connection error:\", err);\n\t\t\t\t// A redirect target that no longer answers is dropped: the redial returns to the\n\t\t\t\t// configured URL, which may still answer. Rust's Reconnect follows the same rule.\n\t\t\t\tif (redirectFailed) this.#redirect.set(undefined);\n\t\t\t\tthis.#retry(effect, connected, err);\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Ask `dials` for the tokens of a dial to `dialing`, within the connect timeout, which the\n\t * signing spends: the tokens and the timeout left for the dial, or the app's refusal. Rejects\n\t * with `ConnectTimeout` once the timeout passes unanswered, or with the teardown once `signal` aborts.\n\t */\n\tasync #sign(dials: Dials, dialing: URL, signal: AbortSignal, failure: Error | undefined): Promise<Signed> {\n\t\tconst limit = this.timeout;\n\t\tconst started = now();\n\t\tconst bound = new AbortController();\n\t\tconst abort = () => bound.abort(signal.reason);\n\t\tif (signal.aborted) abort();\n\t\telse signal.addEventListener(\"abort\", abort, { once: true });\n\t\tconst disarm = limit === null ? () => {} : after(limit, () => bound.abort(new ConnectTimeout(limit)));\n\t\ttry {\n\t\t\tconst answer = await dials.request(dialing, bound.signal, failure);\n\t\t\tif (\"refused\" in answer) return answer;\n\t\t\tif (limit === null) return { tokens: answer.tokens, left: null };\n\t\t\t// Zero is refused as a timeout, so a dial with no time left times out here instead.\n\t\t\tconst left = limit.saturatingSub(now().since(started));\n\t\t\tif (left.isZero()) throw new ConnectTimeout(limit);\n\t\t\treturn { tokens: answer.tokens, left };\n\t\t} finally {\n\t\t\tsignal.removeEventListener(\"abort\", abort);\n\t\t\tdisarm();\n\t\t}\n\t}\n\n\t/**\n\t * Resolve with the WebTransport session that reaches `dialing` while `connection` runs on the\n\t * WebSocket fallback, probing on a jittered backoff from {@link PROBE_INITIAL} up to {@link PROBE_MAX}.\n\t * Never resolves for a session on another transport, where WebTransport is unsupported, or\n\t * once `signal` aborts.\n\t */\n\tasync #probe(connection: Session, dialing: URL, signal: AbortSignal): Promise<Reached> {\n\t\tconst never = new Promise<never>(() => {});\n\t\tif (connection.transport !== \"websocket\" || !webTransportDialed(this.webtransport)) return never;\n\t\ttry {\n\t\t\tfor (let delay = PROBE_INITIAL; ; delay = delay.mul(2).min(PROBE_MAX)) {\n\t\t\t\tawait sleep(delay.mul(0.5 + Math.random() / 2), { signal });\n\t\t\t\tlet tokens = this.tokens.peek();\n\t\t\t\tlet timeout = this.timeout;\n\t\t\t\tif (this.#dials) {\n\t\t\t\t\tlet signed: Signed;\n\t\t\t\t\ttry {\n\t\t\t\t\t\t// The serving session is fine, so the probe reports no failure.\n\t\t\t\t\t\tsigned = await this.#sign(this.#dials, dialing, signal, undefined);\n\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\tif (signal.aborted) throw err;\n\t\t\t\t\t\tconsole.warn(\"a probe's tokens timed out:\", err);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tif (\"refused\" in signed) {\n\t\t\t\t\t\tconsole.warn(\"a probe's dial was refused by its signer:\", signed.refused);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\ttokens = signed.tokens;\n\t\t\t\t\ttimeout = signed.left;\n\t\t\t\t}\n\t\t\t\tconst props = {\n\t\t\t\t\ttokens,\n\t\t\t\t\turlAuth: this.urlAuth,\n\t\t\t\t\tversions: this.versions,\n\t\t\t\t\twebtransport: this.webtransport,\n\t\t\t\t\twebsocket: this.#redirect.peek() ? undefined : this.websocket,\n\t\t\t\t\ttimeout,\n\t\t\t\t};\n\t\t\t\tconst reached = await reachable(dialing, props, signal);\n\t\t\t\tif (reached) return reached;\n\t\t\t}\n\t\t} catch {\n\t\t\t// The sleep rejects once the session ends.\n\t\t\treturn never;\n\t\t}\n\t}\n\n\t/**\n\t * Act on the peer's GOAWAY for `connection`, which was dialed at `dialing`: resolve where\n\t * to go next and leave the old session serving until it drains. Returns false when the\n\t * redirect is refused, which ends the sequence rather than redialing.\n\t */\n\t#migrate(connection: Session, dialing: URL, drain: Goaway): boolean {\n\t\t// The pin is a WebTransport option. A WebSocket that won the race never used it.\n\t\tconst pinned = pinnedTransport(connection.transport, this.#pinned());\n\n\t\tlet next: URL | undefined;\n\t\ttry {\n\t\t\tnext = target(this.goaway.redirect ?? \"same-host\", drain.uri, dialing, pinned);\n\t\t} catch (err) {\n\t\t\t// The peer is leaving and named somewhere we won't go: redialing the old address\n\t\t\t// would ignore it, so stop here.\n\t\t\tconsole.warn(\"GOAWAY redirect refused:\", err);\n\t\t\tthis.#end(connection);\n\t\t\tthis.#serve(undefined);\n\t\t\tthis.#giveUp(error(err));\n\t\t\treturn false;\n\t\t}\n\n\t\t// Only an accepted redirect replaces the URL; an empty one keeps it.\n\t\tif (next) {\n\t\t\tthis.#redirect.set(next);\n\t\t\tthis.#redirectHref = this.#sequenceHref;\n\t\t}\n\n\t\tconsole.info(\"GOAWAY received; migrating\");\n\t\t// A newer GOAWAY retires an older predecessor rather than serving from two.\n\t\tthis.#retire();\n\t\tconst cap = handover(this.goaway.handover ?? DEFAULT_HANDOVER, drain.timeout);\n\t\tconst draining = new Draining(connection, cap, () => {\n\t\t\tif (this.#draining === draining) this.#draining = undefined;\n\t\t\t// If nothing replaced it yet, nothing is serving.\n\t\t\tif (this.established.peek() === connection) this.#serve(undefined);\n\t\t});\n\t\tthis.#draining = draining;\n\t\treturn true;\n\t}\n\n\t/** Whether a certificate pin is configured for WebTransport. */\n\t#pinned(): boolean {\n\t\tconst hashes = this.webtransport?.serverCertificateHashes?.length ?? 0;\n\t\treturn hashes > 0 || this.webtransport?.serverCertificate !== undefined;\n\t}\n\n\t/**\n\t * Follow a redirect the peer of `connection`, a fallback session we left for a probe that\n\t * got through, sends while it drains: whenever nothing else serves, the next dial goes where\n\t * the peer named, and a dial still headed for the leaving peer starts over. A restart in\n\t * place or a refused redirect is ignored, since we are already leaving. No loop scoring:\n\t * only a probe that got through leads here, and the probe's backoff paces those.\n\t */\n\t#follow(connection: Session, dialing: URL, pinned: boolean, href: string): void {\n\t\tvoid connection.draining.then((drain) => {\n\t\t\t// The peer accepted the fallback session and asked us to move, so its GOAWAY establishes\n\t\t\t// the URL as one off the live session does, while the sequence still targets it.\n\t\t\tif (this.#sequenceHref === href) this.#establishedHref = href;\n\t\t\tlet next: URL | undefined;\n\t\t\ttry {\n\t\t\t\tnext = target(this.goaway.redirect ?? \"same-host\", drain.uri, dialing, pinned);\n\t\t\t} catch {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (!next) return;\n\t\t\tthis.#pending = { connection, next };\n\t\t\tthis.#applyPending();\n\t\t});\n\t}\n\n\t/**\n\t * Apply the pending redirect once its session is the one serving, which a replacement that\n\t * closes hands back to; drop it once that session retires.\n\t */\n\t#applyPending(): void {\n\t\tconst pending = this.#pending;\n\t\tif (!pending) return;\n\t\tif (this.#draining?.serving() !== pending.connection) {\n\t\t\tthis.#pending = undefined;\n\t\t\treturn;\n\t\t}\n\t\tif (this.established.peek() !== pending.connection) return;\n\t\tthis.#pending = undefined;\n\t\tconsole.info(\"draining fallback peer redirected; following\");\n\t\tthis.#redirect.set(pending.next);\n\t\tthis.#redirectHref = this.#sequenceHref;\n\t\t// A backoff still paces the next dial, which now goes to the new target.\n\t\tif (this.#dialing) this.#tick.update((prev) => prev + 1);\n\t}\n\n\t/**\n\t * End a session this loop is done with. Its groups in flight finish within the close\n\t * deadline, unless the page is going away: nothing would run to finish them, and an abort\n\t * closes the transport now rather than leaving the browser to sever it.\n\t */\n\t#end(connection: Session): void {\n\t\tif (this.#suspended.peek()) {\n\t\t\tconnection.abort();\n\t\t\treturn;\n\t\t}\n\t\t// A served live track never finishes, so the deadline aborting the rest is the usual end.\n\t\tconst ending = connection.close().catch(() => {});\n\t\tthis.#ending.set(connection, ending);\n\t\tvoid ending.then(() => this.#ending.delete(connection));\n\t}\n\n\t/** Serve `connection`, or nothing. */\n\t#serve(connection: Session | undefined): void {\n\t\tthis.established.set(connection);\n\t\tthis.#report();\n\t}\n\n\t#setDialing(dialing: boolean): void {\n\t\tthis.#dialing = dialing;\n\t\tthis.#report();\n\t}\n\n\t// The one derivation of status: serving, else dialing, else neither. A drained predecessor\n\t// serves until it retires, so its replacement's dial reads as connected.\n\t#report(): void {\n\t\tthis.status.set(this.established.peek() ? \"connected\" : this.#dialing ? \"connecting\" : \"disconnected\");\n\t}\n\n\t/** Stop serving from a drained predecessor, ending it if still open. */\n\t#retire(): void {\n\t\tconst draining = this.#draining?.retire();\n\t\tif (draining) this.#end(draining);\n\t}\n\n\t// A session establishes its URL once the peer accepted its credential, which a closed\n\t// session still reports, or, on a version that never answers the credential\n\t// (moq-lite-03/04), once it stayed up past the healthy bar.\n\t#settle(href: string, session: Session, connected: Instant): void {\n\t\tconst auth = wireOf(session).auth;\n\t\tif (auth.accepted.peek() || (auth.silent && now().since(connected).ge(this.#pacing().healthy))) {\n\t\t\tthis.#establishedHref = href;\n\t\t}\n\t}\n\n\t// Resolved per use rather than at construction, so an edit to `backoff` (including one that\n\t// drops a field back to its default) applies to the next retry.\n\t#pacing() {\n\t\treturn pacing(this.backoff ?? {});\n\t}\n\n\t// When a retry window starting `at` expires.\n\t#window(at: Instant): Instant | null {\n\t\tconst { timeout } = this.#pacing();\n\t\treturn timeout === null ? null : at.saturatingAdd(timeout);\n\t}\n\n\t/**\n\t * Wait out the backoff after a restarting peer drained a session short of the healthy bar.\n\t * The delay escalates, so the redials cannot hammer it, but the wait never spends the retry\n\t * window: the window restarts once the wait is over.\n\t */\n\t#restart(effect: Effect): void {\n\t\tconst wait = this.#backoff();\n\t\tconst tick = this.#tick.peek() + 1;\n\t\teffect.timer(() => {\n\t\t\tthis.#deadline = undefined;\n\t\t\tthis.#tick.update((prev) => Math.max(prev, tick));\n\t\t}, wait);\n\t}\n\n\t// The jittered wait before the next attempt, escalating the delay for the one after.\n\t// Equal jitter, so a fleet of tabs knocked offline together doesn't reconnect on the same tick.\n\t#backoff(): Duration {\n\t\tconst pacing = this.#pacing();\n\t\tthis.#delay ??= pacing.initial;\n\t\tconst wait = this.#delay.mul(0.5 + Math.random() / 2);\n\t\tthis.#delay = pacing.next(this.#delay);\n\t\treturn wait;\n\t}\n\n\t/**\n\t * Schedule the next connect attempt after the current backoff, or stop once the retry window\n\t * has expired. `connected` is when the dead session was established, if it ever was, and\n\t * `cause` the error that killed it, if it died with one.\n\t */\n\t#retry(effect: Effect, connected: Instant | undefined, cause?: unknown): void {\n\t\tthis.#failure.set(cause === undefined ? new Error(\"connection closed\") : error(cause));\n\t\t// A healthy session's end clears the backoff and starts a fresh retry window: a one-off\n\t\t// drop should reconnect promptly. Anything shorter is a peer that accepts and soon\n\t\t// severs, which has to keep escalating or we hammer it forever at the initial delay.\n\t\tif (connected !== undefined && now().since(connected).ge(this.#pacing().healthy)) {\n\t\t\tthis.#delay = undefined;\n\t\t\tthis.#deadline = undefined;\n\t\t}\n\n\t\tconst at = now();\n\t\t// A healthy session's end starts the window here.\n\t\tthis.#deadline ??= this.#window(at);\n\t\tconst wait = this.#backoff();\n\n\t\t// No attempt starts once the window has passed: a wait that reaches the deadline gives up\n\t\t// there instead of dialing.\n\t\tconst deadline = this.#deadline;\n\t\t// A graceful close has no error, so report the timeout itself.\n\t\tconst failure = cause === undefined ? new Error(\"reconnect timed out\") : error(cause);\n\t\tconst giveUp = () => {\n\t\t\tconsole.warn(\"reconnect timed out\");\n\t\t\tthis.#giveUp(failure);\n\t\t};\n\t\tconst left = deadline === null ? undefined : deadline.since(at);\n\t\tif (left !== undefined && wait.ge(left)) {\n\t\t\tif (!left.isZero()) effect.timer(giveUp, left);\n\t\t\telse giveUp();\n\t\t\treturn;\n\t\t}\n\n\t\tconst tick = this.#tick.peek() + 1;\n\t\teffect.timer(() => {\n\t\t\t// Checked again when the wait ends: a timer that fires late, as after the device\n\t\t\t// slept, must not dial past the window.\n\t\t\tif (deadline !== null && now().ge(deadline)) return giveUp();\n\t\t\tthis.#tick.update((prev) => Math.max(prev, tick));\n\t\t}, wait);\n\t}\n\n\t#giveUp(cause: Error): void {\n\t\tthis.#verdict.gaveUp(cause);\n\t\tthis.#error.set(cause);\n\t\tthis.#givenUpHref = this.#sequenceHref;\n\t\tthis.#resetSequence();\n\t}\n\n\t#resetSequence(): void {\n\t\tthis.#failure.set(undefined);\n\t\tthis.#delay = undefined;\n\t\tthis.#deadline = undefined;\n\t\tthis.#sequenceHref = undefined;\n\t\tthis.#redirects.reset();\n\t\tthis.#retire();\n\t}\n\n\t/**\n\t * Resolve once the peer first answers the latest {@link tokens}, like Rust's `Tokens::poll_answered`.\n\t * With {@link Dials}, that is the set the latest dial was answered with, none before the first:\n\t * read a refusal from the next dial's `failure` instead.\n\t *\n\t * It covers the tokens the latest set newly presented, or the initial ones before any set:\n\t * each is granted in band, or is the connection credential a dial carried and the peer\n\t * accepted. A token the set kept, the connection credential included, counts only once the\n\t * peer refuses it, and nothing is re-checked after the answer. Rejects with the peer's refusal,\n\t * `Unsupported` when a session cannot carry a token in band, the loop's end, or the failure that\n\t * stopped it retrying its URL while no session answered, such as a refused first dial. A set replaced\n\t * before its answer moves the wait to the new one.\n\t */\n\tanswered(): Promise<void> {\n\t\treturn this.#verdict.answered();\n\t}\n\n\t/** Stop reconnecting, drain and close the current connection, and settle {@link Reload.closed}. Idempotent. */\n\tclose(abort?: Error) {\n\t\tthis.#signals.close();\n\t\tthis.#retire();\n\t\t// No session will present the tokens again, so they end with the loop, once the sessions\n\t\t// still draining no longer need their grants or a page hide to cut them short.\n\t\tconst err = abort ?? new Error(\"connection closed\");\n\t\tconst done = () => {\n\t\t\tthis.auth.abort(err);\n\t\t\tthis.#suspension.close();\n\t\t};\n\t\tif (this.#ending.size === 0) done();\n\t\telse void Promise.all(this.#ending.values()).then(done);\n\t\tif (this.#closed.peek() === undefined) this.#closed.set(abort ?? null);\n\t}\n}\n\n/**\n * Pump `upstream` into `producer` for the rest of `effect`'s run: its events, then an `offline`\n * for each route still active once it closes or the run ends, so nothing clings to a source\n * that went away. Synced follows the upstream's, and owes those retractions too.\n *\n * @internal\n */\nexport function pumpAnnounced(effect: Effect, upstream: Announce.Routes, producer: Announce.Producer) {\n\t// The last event per active route rides along for its retraction.\n\tconst active = new Map<Path.Valid, Announce.Routed>();\n\tlet live = true;\n\tconst retract = () => {\n\t\tlive = false;\n\t\tif (producer.closed.peek() !== undefined || active.size === 0) return;\n\t\t// Behind first, so a reader parked on the stream takes these as owed, not as news.\n\t\tproducer.behind();\n\t\t// The source went away, which says nothing of whether the origin ended them.\n\t\tfor (const entry of active.values()) producer.append({ ...entry, kind: \"offline\" });\n\t\tactive.clear();\n\t};\n\n\t// Torn down in reverse: the mirror stops, the retractions land, then the upstream closes,\n\t// so its closing never reads as synced.\n\teffect.cleanup(() => upstream.close());\n\teffect.cleanup(retract);\n\t// A new upstream owes its own initial set, and the retractions of the one before.\n\tproducer.behind();\n\teffect.watch(upstream.synced, (synced) => {\n\t\tif (!synced) producer.behind();\n\t\telse if (upstream.closed.peek() === undefined) producer.synced();\n\t});\n\n\teffect.spawn(async () => {\n\t\ttry {\n\t\t\tfor (;;) {\n\t\t\t\tconst entry = await effect.race([upstream.next()]);\n\t\t\t\tif (!entry || !live || producer.closed.peek() !== undefined) break;\n\t\t\t\tif (entry.kind === \"end\" || entry.kind === \"offline\") active.delete(entry.prefix);\n\t\t\t\telse active.set(entry.prefix, entry);\n\t\t\t\tproducer.append(entry);\n\t\t\t}\n\t\t} catch {\n\t\t\t// A dropped connection resets the announce stream; the retractions below cover it.\n\t\t} finally {\n\t\t\tif (live) {\n\t\t\t\t// The upstream ended on its own: nothing more comes from it, so once its\n\t\t\t\t// retractions are read there is nothing left to wait for.\n\t\t\t\tretract();\n\t\t\t\tproducer.behind();\n\t\t\t\tproducer.synced();\n\t\t\t}\n\t\t}\n\t});\n}\n\n/**\n * A session the peer sent GOAWAY on, left serving so its groups in flight finish. It retires\n * when it closes on its own, overstays its handover window, or is retired by the loop, and\n * `onRetire` runs once either way. The window still caps a retired session's close: it is\n * aborted at the window's end if still open.\n */\nclass Draining {\n\t#connection: Session;\n\t#timer = new AbortController();\n\t#onRetire: () => void;\n\t#retired = false;\n\n\tconstructor(connection: Session, handover: Duration, onRetire: () => void) {\n\t\tthis.#connection = connection;\n\t\tthis.#onRetire = onRetire;\n\t\tvoid sleep(handover, { signal: this.#timer.signal }).then(\n\t\t\t() => {\n\t\t\t\tif (this.retire()) console.warn(\"old session did not drain in time; closing\");\n\t\t\t\tconnection.abort();\n\t\t\t},\n\t\t\t() => {},\n\t\t);\n\t\tvoid connection.closed.then(() => {\n\t\t\tthis.#timer.abort();\n\t\t\tthis.retire();\n\t\t});\n\t}\n\n\t/** The old session while it still serves, before it retires. */\n\tserving(): Session | undefined {\n\t\treturn this.#retired ? undefined : this.#connection;\n\t}\n\n\t/** Stop serving from the old session, returning it the first time for the caller to end. */\n\tretire(): Session | undefined {\n\t\tif (this.#retired) return undefined;\n\t\tthis.#retired = true;\n\t\tthis.#onRetire();\n\t\treturn this.#connection;\n\t}\n}\n\n/**\n * Where `url` dials, without its userinfo, query, or fragment, where a peer may mint fresh\n * credentials on every redirect, and with its host as the dial reads it. Two URLs that differ\n * only there reach the same place.\n */\nfunction destination(url: URL): string {\n\tconst bare = new URL(parse(url).url);\n\tbare.username = \"\";\n\tbare.password = \"\";\n\tbare.search = \"\";\n\tbare.hash = \"\";\n\treturn bare.href;\n}\n\n/**\n * A run of GOAWAY redirects, and whether it has revisited an endpoint. The peer picks every\n * hop, so remembering them all would grow without bound. Brent's cycle detection instead keeps\n * one departed endpoint, replaced at doubling intervals, and catches a cycle of any length\n * within a few laps of it. Once caught, the run stays a loop until reset.\n */\nexport class Redirects {\n\t#mark: string | undefined;\n\t#span = 1;\n\t#hops = 0;\n\t#loop = false;\n\n\t/** Record leaving `from` for a different endpoint `to`, and return whether this run loops. */\n\tmove(from: string, to: string): boolean {\n\t\tif (to === this.#mark) this.#loop = true;\n\t\tif (++this.#hops === this.#span) {\n\t\t\tthis.#mark = from;\n\t\t\tthis.#span *= 2;\n\t\t\tthis.#hops = 0;\n\t\t}\n\t\treturn this.#loop;\n\t}\n\n\t/** Start a new run. */\n\treset(): void {\n\t\tthis.#mark = undefined;\n\t\tthis.#span = 1;\n\t\tthis.#hops = 0;\n\t\tthis.#loop = false;\n\t}\n}\n"]}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import type { GetPromise, Getter } from "@moq/signals";
|
|
2
|
+
import type * as announce from "../announce.ts";
|
|
3
|
+
import type * as Auth from "../auth.ts";
|
|
4
|
+
import type * as Path from "../path.ts";
|
|
5
|
+
import type { Goaway } from "./goaway.ts";
|
|
6
|
+
import type { Liveness } from "./liveness.ts";
|
|
7
|
+
import type { Probe, Stats } from "./stats.ts";
|
|
8
|
+
import type { Transport } from "./transport.ts";
|
|
9
|
+
/**
|
|
10
|
+
* An established MoQ session, implemented by both the moq-lite and moq-ietf protocols.
|
|
11
|
+
*
|
|
12
|
+
* Publishing goes through an origin, not the session: pass an `Origin.Consumer` as the
|
|
13
|
+
* `publish` connect option and the session announces and serves that origin's broadcasts.
|
|
14
|
+
*/
|
|
15
|
+
export interface Session {
|
|
16
|
+
/** URL of the connected server. */
|
|
17
|
+
readonly url: URL;
|
|
18
|
+
/** Negotiated wire protocol version. */
|
|
19
|
+
readonly version: string;
|
|
20
|
+
/** The wire transport this session runs over. */
|
|
21
|
+
readonly transport: Transport;
|
|
22
|
+
/**
|
|
23
|
+
* Estimates measured by the peer, updated as PROBE messages arrive. Stays empty on
|
|
24
|
+
* versions without PROBE. Observe it to request updates; `peek()` alone is passive.
|
|
25
|
+
* See {@link Stats} for what the local transport counts.
|
|
26
|
+
*/
|
|
27
|
+
readonly probe: Getter<Probe>;
|
|
28
|
+
/**
|
|
29
|
+
* Whether the peer was heard within twice the transport's probe interval, or undefined on a
|
|
30
|
+
* transport that can't probe its peer: WebTransport, which has no ping, and qmux-00. The
|
|
31
|
+
* WebSocket transport probes a peer unheard for 3/10 of its idle timeout, turns `stale` after
|
|
32
|
+
* two of those, and `live` again on the peer's next frame; only the idle timeout closes it.
|
|
33
|
+
*/
|
|
34
|
+
readonly liveness: Getter<Liveness> | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* The tokens this side presented and the grant they earned, plus the tokens the peer
|
|
37
|
+
* presents. On moq-lite-07 each side presents its connection's credential right after
|
|
38
|
+
* setup. Otherwise the grant stays undefined.
|
|
39
|
+
*
|
|
40
|
+
* The handle passed to `connect` as `auth`, or else one the session created for itself,
|
|
41
|
+
* which ends with it.
|
|
42
|
+
*/
|
|
43
|
+
readonly auth: Auth.Handle;
|
|
44
|
+
/**
|
|
45
|
+
* The implementation the peer advertised in its SETUP, such as `moq-net-rs/0.3.10`.
|
|
46
|
+
*
|
|
47
|
+
* Resolves once the peer's SETUP is read: `undefined` when it advertised none, its version
|
|
48
|
+
* carries none (moq-lite 01 to 04), or the session closed first. Never rejects.
|
|
49
|
+
* Peer-controlled: use it for logs and rollout counts, never to authorize.
|
|
50
|
+
*/
|
|
51
|
+
readonly peerImplementation: Promise<string | undefined>;
|
|
52
|
+
/**
|
|
53
|
+
* Subscribe to broadcast announcements at or beneath `prefix` (default the session
|
|
54
|
+
* root). Paths are relative to the session. Routes above the prefix are reported only
|
|
55
|
+
* when `options.covering` opts in, and hidden routes only when `options.hidden` does. A peer without
|
|
56
|
+
* discovery refuses or resets the stream.
|
|
57
|
+
*/
|
|
58
|
+
announced(prefix?: Path.Valid, options?: announce.Options): announce.Consumer;
|
|
59
|
+
/**
|
|
60
|
+
* Snapshot the transport's counters, querying it fresh on each call.
|
|
61
|
+
*
|
|
62
|
+
* Resolves to an empty snapshot on a transport without `getStats()`. Sample it on
|
|
63
|
+
* whatever schedule you need rather than expecting the library to poll for you.
|
|
64
|
+
*/
|
|
65
|
+
stats(): Promise<Stats>;
|
|
66
|
+
/**
|
|
67
|
+
* Withdraw announcements and drain for up to one second, then close the session.
|
|
68
|
+
*
|
|
69
|
+
* Lite-05 and newer wait for the subscriber to read finished tails; older Lite versions
|
|
70
|
+
* wait only for transport ACKs. IETF media streams are not drained.
|
|
71
|
+
*/
|
|
72
|
+
close(): Promise<void>;
|
|
73
|
+
/** End the session immediately without waiting for delivery. */
|
|
74
|
+
abort(): void;
|
|
75
|
+
/**
|
|
76
|
+
* Settles with the peer's GOAWAY, its request that this session move elsewhere. The session
|
|
77
|
+
* keeps serving until it closes, and a one-shot session never moves on its own, so answer it
|
|
78
|
+
* by connecting again and closing this one. Stays pending if the session closes without one.
|
|
79
|
+
*
|
|
80
|
+
* The URI is peer-controlled: apply a redirect policy you trust before dialing it or presenting
|
|
81
|
+
* tokens to it, as the reconnecting `Connection` does with `goaway.redirect`.
|
|
82
|
+
*/
|
|
83
|
+
readonly draining: GetPromise<Goaway>;
|
|
84
|
+
/**
|
|
85
|
+
* Settles when the session closes: `null` for a clean close, an `Errors.Session` when the
|
|
86
|
+
* peer closed with a code (e.g. `SessionCode.Unauthorized` for an auth rejection), or the
|
|
87
|
+
* transport's own failure. Never rejects.
|
|
88
|
+
*/
|
|
89
|
+
readonly closed: GetPromise<Error | null>;
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/connection/session.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,KAAK,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAEhD,OAAO,KAAK,KAAK,IAAI,MAAM,YAAY,CAAC;AACxC,OAAO,KAAK,KAAK,IAAI,MAAM,YAAY,CAAC;AACxC,OAAO,KAAK,EAAE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,GAAG,IAAI,CAAC,CAAC;CAC1C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../src/connection/session.ts"],"names":[],"mappings":"","sourcesContent":["import type { GetPromise, Getter } from \"@moq/signals\";\nimport type * as announce from \"../announce.ts\";\nimport type { RouteOptions, Routes } from \"../announced.ts\";\nimport type * as Auth from \"../auth.ts\";\nimport type * as Path from \"../path.ts\";\nimport type { Goaway } from \"./goaway.ts\";\nimport type { Liveness } from \"./liveness.ts\";\nimport type { Probe, Stats } from \"./stats.ts\";\nimport type { Transport } from \"./transport.ts\";\n\n/**\n * An established MoQ session, implemented by both the moq-lite and moq-ietf protocols.\n *\n * Publishing goes through an origin, not the session: pass an `Origin.Consumer` as the\n * `publish` connect option and the session announces and serves that origin's broadcasts.\n */\nexport interface Session {\n\t/** URL of the connected server. */\n\treadonly url: URL;\n\n\t/** Negotiated wire protocol version. */\n\treadonly version: string;\n\n\t/** The wire transport this session runs over. */\n\treadonly transport: Transport;\n\n\t/**\n\t * Estimates measured by the peer, updated as PROBE messages arrive. Stays empty on\n\t * versions without PROBE. Observe it to request updates; `peek()` alone is passive.\n\t * See {@link Stats} for what the local transport counts.\n\t */\n\treadonly probe: Getter<Probe>;\n\n\t/**\n\t * Whether the peer was heard within twice the transport's probe interval, or undefined on a\n\t * transport that can't probe its peer: WebTransport, which has no ping, and qmux-00. The\n\t * WebSocket transport probes a peer unheard for 3/10 of its idle timeout, turns `stale` after\n\t * two of those, and `live` again on the peer's next frame; only the idle timeout closes it.\n\t */\n\treadonly liveness: Getter<Liveness> | undefined;\n\n\t/**\n\t * The tokens this side presented and the grant they earned, plus the tokens the peer\n\t * presents. On moq-lite-07 each side presents its connection's credential right after\n\t * setup. Otherwise the grant stays undefined.\n\t *\n\t * The handle passed to `connect` as `auth`, or else one the session created for itself,\n\t * which ends with it.\n\t */\n\treadonly auth: Auth.Handle;\n\n\t/**\n\t * The implementation the peer advertised in its SETUP, such as `moq-net-rs/0.3.10`.\n\t *\n\t * Resolves once the peer's SETUP is read: `undefined` when it advertised none, its version\n\t * carries none (moq-lite 01 to 04), or the session closed first. Never rejects.\n\t * Peer-controlled: use it for logs and rollout counts, never to authorize.\n\t */\n\treadonly peerImplementation: Promise<string | undefined>;\n\n\t/**\n\t * Subscribe to broadcast announcements at or beneath `prefix` (default the session\n\t * root). Paths are relative to the session. Routes above the prefix are reported only\n\t * when `options.covering` opts in, and hidden routes only when `options.hidden` does. A peer without\n\t * discovery refuses or resets the stream.\n\t */\n\tannounced(prefix?: Path.Valid, options?: announce.Options): announce.Consumer;\n\n\t/** Every route change at or beneath `prefix`, for code that forwards routes. @internal */\n\troutes(prefix?: Path.Valid, options?: RouteOptions): Routes;\n\n\t/**\n\t * Snapshot the transport's counters, querying it fresh on each call.\n\t *\n\t * Resolves to an empty snapshot on a transport without `getStats()`. Sample it on\n\t * whatever schedule you need rather than expecting the library to poll for you.\n\t */\n\tstats(): Promise<Stats>;\n\n\t/**\n\t * Withdraw announcements and drain for up to one second, then close the session.\n\t *\n\t * Lite-05 and newer wait for the subscriber to read finished tails; older Lite versions\n\t * wait only for transport ACKs. IETF media streams are not drained.\n\t */\n\tclose(): Promise<void>;\n\n\t/** End the session immediately without waiting for delivery. */\n\tabort(): void;\n\n\t/**\n\t * Settles with the peer's GOAWAY, its request that this session move elsewhere. The session\n\t * keeps serving until it closes, and a one-shot session never moves on its own, so answer it\n\t * by connecting again and closing this one. Stays pending if the session closes without one.\n\t *\n\t * The URI is peer-controlled: apply a redirect policy you trust before dialing it or presenting\n\t * tokens to it, as the reconnecting `Connection` does with `goaway.redirect`.\n\t */\n\treadonly draining: GetPromise<Goaway>;\n\n\t/**\n\t * Settles when the session closes: `null` for a clean close, an `Errors.Session` when the\n\t * peer closed with a code (e.g. `SessionCode.Unauthorized` for an auth rejection), or the\n\t * transport's own failure. Never rejects.\n\t */\n\treadonly closed: GetPromise<Error | null>;\n}\n"]}
|
package/connection/stats.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { Duration, type Instant } from "@moq/clock";
|
|
1
2
|
/**
|
|
2
3
|
* Connection statistics: what the local transport counts, and what the peer reports.
|
|
3
4
|
*
|
|
4
5
|
* @module
|
|
5
6
|
*/
|
|
6
|
-
import * as Time from "../time";
|
|
7
7
|
/**
|
|
8
8
|
* A point-in-time snapshot of the transport's counters, from `WebTransport.getStats()`.
|
|
9
9
|
*
|
|
@@ -11,8 +11,8 @@ import * as Time from "../time";
|
|
|
11
11
|
* a caller computing a rate wants to choose its own sampling instants. Snapshot twice
|
|
12
12
|
* and divide by the interval you measured.
|
|
13
13
|
*
|
|
14
|
-
* Every field is optional. The qmux/WebSocket fallback
|
|
15
|
-
*
|
|
14
|
+
* Every field is optional. The qmux/WebSocket fallback reports nothing; see
|
|
15
|
+
* {@link Probe} for what the peer measures.
|
|
16
16
|
*
|
|
17
17
|
* The field names match Rust's `moq_net::session::Stats` but the counters keep each
|
|
18
18
|
* stack's own semantics rather than being normalized. Notably W3C excludes
|
|
@@ -25,10 +25,9 @@ export interface Stats {
|
|
|
25
25
|
/**
|
|
26
26
|
* Smoothed round-trip time estimate in milliseconds.
|
|
27
27
|
*
|
|
28
|
-
*
|
|
29
|
-
* has the field. Use {@link Probe.rtt}, which the peer measures.
|
|
28
|
+
* Use {@link Probe.rtt} when the local transport omits it.
|
|
30
29
|
*/
|
|
31
|
-
rtt?:
|
|
30
|
+
rtt?: Duration;
|
|
32
31
|
/** Estimated send bandwidth from the congestion controller, in bits per second. */
|
|
33
32
|
estimatedSendRate?: number;
|
|
34
33
|
/** Total bytes sent on streams and datagrams, excluding retransmissions and QUIC overhead. */
|
|
@@ -43,6 +42,17 @@ export interface Stats {
|
|
|
43
42
|
packetsReceived?: number;
|
|
44
43
|
/** Packets currently declared lost. The estimate can decrease when a loss proves spurious. */
|
|
45
44
|
packetsLost?: number;
|
|
45
|
+
/**
|
|
46
|
+
* Datagrams received for a subscription with no datagram track: one this session doesn't
|
|
47
|
+
* know, has ended, or whose answer it hasn't received. Absent on a version without datagrams:
|
|
48
|
+
* moq-transport and moq-lite before 05.
|
|
49
|
+
*/
|
|
50
|
+
datagramsUnrouted?: number;
|
|
51
|
+
}
|
|
52
|
+
/** Transport counters with their sampling instant. @public */
|
|
53
|
+
export interface Sample extends Stats {
|
|
54
|
+
/** When the request for these counters began on the monotonic clock. */
|
|
55
|
+
at: Instant;
|
|
46
56
|
}
|
|
47
57
|
/**
|
|
48
58
|
* Estimates measured by the peer and delivered over the MoQ PROBE stream.
|
|
@@ -58,12 +68,11 @@ export interface Probe {
|
|
|
58
68
|
/**
|
|
59
69
|
* Round-trip time in milliseconds.
|
|
60
70
|
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
* transport-level RTT would.
|
|
71
|
+
* Available on sessions whose peer reports it, even if the local transport has
|
|
72
|
+
* no stats. It includes the peer's application-layer processing time.
|
|
64
73
|
*/
|
|
65
|
-
rtt?:
|
|
66
|
-
/** The peer's estimate
|
|
74
|
+
rtt?: Duration;
|
|
75
|
+
/** The peer's send-rate estimate toward us, so our receive rate, in bits per second. */
|
|
67
76
|
estimatedRecvRate?: number;
|
|
68
77
|
}
|
|
69
78
|
//# sourceMappingURL=stats.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../../src/connection/stats.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../../src/connection/stats.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,OAAO,EAAE,MAAM,YAAY,CAAC;AAGpD;;;;GAIG;AAEH;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,KAAK;IACrB;;;;OAIG;IACH,GAAG,CAAC,EAAE,QAAQ,CAAC;IAEf,mFAAmF;IACnF,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B,8FAA8F;IAC9F,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,oGAAoG;IACpG,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,4FAA4F;IAC5F,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,qDAAqD;IACrD,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,oDAAoD;IACpD,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB,8FAA8F;IAC9F,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,8DAA8D;AAC9D,MAAM,WAAW,MAAO,SAAQ,KAAK;IACpC,wEAAwE;IACxE,EAAE,EAAE,OAAO,CAAC;CACZ;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,KAAK;IACrB;;;;;OAKG;IACH,GAAG,CAAC,EAAE,QAAQ,CAAC;IAEf,wFAAwF;IACxF,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC3B"}
|
package/connection/stats.js
CHANGED
|
@@ -1,24 +1,55 @@
|
|
|
1
|
-
|
|
1
|
+
import { Duration } from "@moq/clock";
|
|
2
|
+
import { transportOf } from "./transport.js";
|
|
3
|
+
// Transports whose `getStats()` is a stub that measures nothing.
|
|
4
|
+
const stubs = new WeakSet();
|
|
2
5
|
/**
|
|
3
|
-
*
|
|
6
|
+
* Decide at setup whether `quic`'s `getStats()` measures anything. Safari's is a stub
|
|
7
|
+
* whose `smoothedRtt` and counters are always 0 and whose `estimatedSendRate` is null;
|
|
8
|
+
* QUIC's smoothed RTT starts at 333 ms, so a 0 RTT with no rate means nothing was
|
|
9
|
+
* measured: the transport is then treated as having no `getStats()` at all. A rate
|
|
10
|
+
* alongside a 0 RTT keeps the transport usable. Only this setup-time call decides, so a real RTT from a
|
|
11
|
+
* later WebKit lifts the rule.
|
|
4
12
|
*
|
|
5
|
-
* @
|
|
13
|
+
* @internal
|
|
6
14
|
*/
|
|
7
|
-
|
|
15
|
+
export async function inspect(quic) {
|
|
16
|
+
const getStats = quic.getStats;
|
|
17
|
+
if (typeof getStats !== "function")
|
|
18
|
+
return;
|
|
19
|
+
try {
|
|
20
|
+
const stats = await getStats.call(quic);
|
|
21
|
+
if (stats.smoothedRtt === 0 && stats.estimatedSendRate == null)
|
|
22
|
+
stubs.add(quic);
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
// A transport that can't answer now may later; `transportStats` handles the rejection.
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* `quic`'s `getStats()`, or `undefined` when it has none or {@link inspect} found a stub.
|
|
30
|
+
*
|
|
31
|
+
* @internal
|
|
32
|
+
*/
|
|
33
|
+
export function statsOf(quic) {
|
|
34
|
+
const getStats = quic.getStats;
|
|
35
|
+
if (typeof getStats !== "function" || stubs.has(quic))
|
|
36
|
+
return undefined;
|
|
37
|
+
return () => getStats.call(quic);
|
|
38
|
+
}
|
|
8
39
|
/**
|
|
9
40
|
* Snapshot `quic` via `getStats()`, or an empty snapshot when the transport doesn't
|
|
10
|
-
* implement it (
|
|
41
|
+
* implement it (older browsers), it is a stub, or the call fails.
|
|
11
42
|
*
|
|
12
43
|
* @internal
|
|
13
44
|
*/
|
|
14
45
|
export async function transportStats(quic) {
|
|
15
|
-
const getStats = quic
|
|
16
|
-
if (
|
|
46
|
+
const getStats = statsOf(quic);
|
|
47
|
+
if (!getStats)
|
|
17
48
|
return {};
|
|
18
49
|
try {
|
|
19
|
-
const stats = await getStats
|
|
50
|
+
const stats = await getStats();
|
|
20
51
|
return {
|
|
21
|
-
rtt: stats.smoothedRtt !== undefined ?
|
|
52
|
+
rtt: stats.smoothedRtt !== undefined ? Duration.millis(stats.smoothedRtt) : undefined,
|
|
22
53
|
estimatedSendRate: stats.estimatedSendRate ?? undefined,
|
|
23
54
|
bytesSent: stats.bytesSent,
|
|
24
55
|
bytesReceived: stats.bytesReceived,
|
|
@@ -32,4 +63,28 @@ export async function transportStats(quic) {
|
|
|
32
63
|
return {};
|
|
33
64
|
}
|
|
34
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* Whether `quic` can report a send-rate estimate: only a WebTransport session with a
|
|
68
|
+
* real `getStats()`. The WebSocket fallback reports no estimate.
|
|
69
|
+
*
|
|
70
|
+
* @internal
|
|
71
|
+
*/
|
|
72
|
+
export function canEstimate(quic) {
|
|
73
|
+
return transportOf(quic) === "webtransport" && statsOf(quic) !== undefined;
|
|
74
|
+
}
|
|
75
|
+
// The sessions whose transport can report a send-rate estimate.
|
|
76
|
+
const estimating = new WeakSet();
|
|
77
|
+
/** Record whether `session`'s transport `quic` can report a send-rate estimate. @internal */
|
|
78
|
+
export function detect(session, quic) {
|
|
79
|
+
if (canEstimate(quic))
|
|
80
|
+
estimating.add(session);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Whether `session` can report a send-rate estimate, so sampling it is worth a timer.
|
|
84
|
+
*
|
|
85
|
+
* @internal
|
|
86
|
+
*/
|
|
87
|
+
export function estimates(session) {
|
|
88
|
+
return estimating.has(session);
|
|
89
|
+
}
|
|
35
90
|
//# sourceMappingURL=stats.js.map
|