@moq/net 0.4.1 → 0.4.2
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/broadcast.d.ts +21 -7
- package/broadcast.d.ts.map +1 -1
- package/broadcast.js +38 -16
- package/broadcast.js.map +1 -1
- package/connection/accept.js +6 -4
- package/connection/accept.js.map +1 -1
- package/connection/connect.d.ts.map +1 -1
- package/connection/connect.js +5 -4
- package/connection/connect.js.map +1 -1
- package/connection/forward.js +54 -47
- package/connection/forward.js.map +1 -1
- package/connection/goaway.d.ts +34 -0
- package/connection/goaway.d.ts.map +1 -0
- package/connection/goaway.js +176 -0
- package/connection/goaway.js.map +1 -0
- package/connection/handshake.d.ts +4 -2
- package/connection/handshake.d.ts.map +1 -1
- package/connection/handshake.js +42 -10
- package/connection/handshake.js.map +1 -1
- package/connection/pool.d.ts +16 -1
- package/connection/pool.d.ts.map +1 -1
- package/connection/pool.js +32 -10
- package/connection/pool.js.map +1 -1
- package/connection/reload.d.ts.map +1 -1
- package/connection/reload.js +184 -30
- package/connection/reload.js.map +1 -1
- package/error.d.ts +11 -0
- package/error.d.ts.map +1 -1
- package/error.js +14 -0
- package/error.js.map +1 -1
- package/errors.d.ts +1 -1
- package/errors.d.ts.map +1 -1
- package/errors.js +1 -1
- package/errors.js.map +1 -1
- package/group.d.ts.map +1 -1
- package/group.js +5 -4
- package/group.js.map +1 -1
- package/hop.d.ts +8 -0
- package/hop.d.ts.map +1 -1
- package/hop.js +16 -0
- package/hop.js.map +1 -1
- package/ietf/adapter.d.ts +4 -0
- package/ietf/adapter.d.ts.map +1 -1
- package/ietf/adapter.js +19 -8
- package/ietf/adapter.js.map +1 -1
- package/ietf/cluster.d.ts +3 -3
- package/ietf/cluster.js +3 -3
- package/ietf/cluster.js.map +1 -1
- package/ietf/connection.d.ts.map +1 -1
- package/ietf/connection.js +110 -37
- package/ietf/connection.js.map +1 -1
- package/ietf/fetch.d.ts +7 -20
- package/ietf/fetch.d.ts.map +1 -1
- package/ietf/fetch.js +52 -22
- package/ietf/fetch.js.map +1 -1
- package/ietf/filter.d.ts +2 -0
- package/ietf/filter.d.ts.map +1 -1
- package/ietf/filter.js +4 -0
- package/ietf/filter.js.map +1 -1
- package/ietf/goaway.d.ts +9 -1
- package/ietf/goaway.d.ts.map +1 -1
- package/ietf/goaway.js +20 -0
- package/ietf/goaway.js.map +1 -1
- package/ietf/hidden.js +1 -1
- package/ietf/hidden.js.map +1 -1
- package/ietf/index.d.ts +1 -1
- package/ietf/index.d.ts.map +1 -1
- package/ietf/index.js +1 -1
- package/ietf/index.js.map +1 -1
- package/ietf/object.d.ts +7 -6
- package/ietf/object.d.ts.map +1 -1
- package/ietf/object.js +37 -33
- package/ietf/object.js.map +1 -1
- package/ietf/parameters.d.ts +7 -0
- package/ietf/parameters.d.ts.map +1 -1
- package/ietf/parameters.js +62 -12
- package/ietf/parameters.js.map +1 -1
- package/ietf/publish_namespace.d.ts +2 -2
- package/ietf/publish_namespace.js +2 -2
- package/ietf/publish_namespace.js.map +1 -1
- package/ietf/publisher.js +287 -172
- package/ietf/publisher.js.map +1 -1
- package/ietf/subscribe.d.ts +7 -1
- package/ietf/subscribe.d.ts.map +1 -1
- package/ietf/subscribe.js +22 -14
- package/ietf/subscribe.js.map +1 -1
- package/ietf/subscribe_namespace.d.ts.map +1 -1
- package/ietf/subscribe_namespace.js +2 -3
- package/ietf/subscribe_namespace.js.map +1 -1
- package/ietf/subscriber.js +57 -42
- package/ietf/subscriber.js.map +1 -1
- package/ietf/token.d.ts +2 -0
- package/ietf/token.d.ts.map +1 -0
- package/ietf/token.js +99 -0
- package/ietf/token.js.map +1 -0
- package/ietf/track.d.ts +4 -0
- package/ietf/track.d.ts.map +1 -1
- package/ietf/track.js +6 -20
- package/ietf/track.js.map +1 -1
- package/index.d.ts +1 -1
- package/index.d.ts.map +1 -1
- package/index.js.map +1 -1
- package/internal.d.ts +12 -3
- package/internal.d.ts.map +1 -1
- package/internal.js +32 -0
- package/internal.js.map +1 -1
- package/lite/announce.d.ts.map +1 -1
- package/lite/announce.js +7 -4
- package/lite/announce.js.map +1 -1
- package/lite/connection.d.ts.map +1 -1
- package/lite/connection.js +22 -7
- package/lite/connection.js.map +1 -1
- package/lite/datagram.d.ts +3 -2
- package/lite/datagram.d.ts.map +1 -1
- package/lite/datagram.js +7 -8
- package/lite/datagram.js.map +1 -1
- package/lite/group.d.ts +12 -8
- package/lite/group.d.ts.map +1 -1
- package/lite/group.js +37 -16
- package/lite/group.js.map +1 -1
- package/lite/message.d.ts +2 -2
- package/lite/message.d.ts.map +1 -1
- package/lite/message.js +14 -5
- package/lite/message.js.map +1 -1
- package/lite/publisher.js +19 -37
- package/lite/publisher.js.map +1 -1
- package/lite/setup.d.ts +1 -1
- package/lite/setup.d.ts.map +1 -1
- package/lite/setup.js +22 -19
- package/lite/setup.js.map +1 -1
- package/lite/subscriber.d.ts.map +1 -1
- package/lite/subscriber.js +206 -127
- package/lite/subscriber.js.map +1 -1
- package/origin.d.ts +9 -1
- package/origin.d.ts.map +1 -1
- package/origin.js +341 -146
- package/origin.js.map +1 -1
- package/package.json +2 -2
- package/stream.d.ts +77 -12
- package/stream.d.ts.map +1 -1
- package/stream.js +359 -122
- package/stream.js.map +1 -1
- package/tail.d.ts +7 -0
- package/tail.d.ts.map +1 -1
- package/tail.js +68 -22
- package/tail.js.map +1 -1
- package/track.d.ts +14 -3
- package/track.d.ts.map +1 -1
- package/track.js +170 -76
- package/track.js.map +1 -1
- package/util/abort.d.ts +2 -0
- package/util/abort.d.ts.map +1 -0
- package/util/abort.js +20 -0
- package/util/abort.js.map +1 -0
- package/util/u64.d.ts +39 -0
- package/util/u64.d.ts.map +1 -0
- package/util/u64.js +83 -0
- package/util/u64.js.map +1 -0
- package/util/varint.d.ts +29 -0
- package/util/varint.d.ts.map +1 -0
- package/util/varint.js +198 -0
- package/util/varint.js.map +1 -0
- package/varint.d.ts +10 -6
- package/varint.d.ts.map +1 -1
- package/varint.js +40 -237
- package/varint.js.map +1 -1
- package/wire.d.ts +17 -3
- package/wire.d.ts.map +1 -1
- package/wire.js.map +1 -1
- package/ietf/control.d.ts +0 -135
- package/ietf/control.d.ts.map +0 -1
- package/ietf/control.js +0 -242
- package/ietf/control.js.map +0 -1
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import * as Ietf from "../ietf/index";
|
|
2
|
-
import { Stream } from "../stream";
|
|
2
|
+
import { Reader, Stream } from "../stream";
|
|
3
3
|
/**
|
|
4
4
|
* Draft-17+ SETUP exchange. Each side opens a uni stream, writes its Setup
|
|
5
5
|
* message, and reads the peer's Setup off an incoming uni stream. The two
|
|
6
6
|
* halves run in parallel and the protocol is symmetric, so both `connect`
|
|
7
7
|
* (client) and `accept` (server) use this same function.
|
|
8
8
|
*
|
|
9
|
-
* Returns the control stream
|
|
9
|
+
* Returns the control stream, the uni streams that arrived before it (see
|
|
10
|
+
* {@link receiveSetup}), plus what the peer's SETUP declared: whether it requires
|
|
10
11
|
* solicitation, which decides whether we announce namespaces unprompted (see the MoQ Solicit
|
|
11
12
|
* extension), and its Hop ID (see the MoQ Cluster extension). We declare both ourselves on
|
|
12
13
|
* every session: we send SUBSCRIBE_NAMESPACE for each prefix we want, so an unsolicited
|
|
@@ -15,6 +16,7 @@ import { Stream } from "../stream";
|
|
|
15
16
|
*/
|
|
16
17
|
export declare function exchangeSetup(transport: WebTransport, version: Ietf.IetfVersion, implementation: string): Promise<{
|
|
17
18
|
control: Stream;
|
|
19
|
+
early: Reader[];
|
|
18
20
|
solicit: boolean | undefined;
|
|
19
21
|
hidden: boolean;
|
|
20
22
|
cluster: Ietf.Cluster.Hops;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handshake.d.ts","sourceRoot":"","sources":["../../src/connection/handshake.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"handshake.d.ts","sourceRoot":"","sources":["../../src/connection/handshake.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,IAAI,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAyB,MAAM,cAAc,CAAC;AAErE;;;;;;;;;;;;;GAaG;AACH,wBAAsB,aAAa,CAClC,SAAS,EAAE,YAAY,EACvB,OAAO,EAAE,IAAI,CAAC,WAAW,EACzB,cAAc,EAAE,MAAM,GACpB,OAAO,CAAC;IACV,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,EAAE,OAAO,GAAG,SAAS,CAAC;IAC7B,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;CAC3B,CAAC,CA0BD"}
|
package/connection/handshake.js
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
/* @ts-self-types="./handshake.d.ts" */
|
|
2
|
+
import { StreamError } from "../error.js";
|
|
2
3
|
import { randomHop } from "../hop.js";
|
|
3
4
|
import * as Ietf from "../ietf/index.js";
|
|
4
|
-
import { Reader, Stream, Writer } from "../stream.js";
|
|
5
|
+
import { Reader, Stream, UnexpectedEnd, Writer } from "../stream.js";
|
|
5
6
|
/**
|
|
6
7
|
* Draft-17+ SETUP exchange. Each side opens a uni stream, writes its Setup
|
|
7
8
|
* message, and reads the peer's Setup off an incoming uni stream. The two
|
|
8
9
|
* halves run in parallel and the protocol is symmetric, so both `connect`
|
|
9
10
|
* (client) and `accept` (server) use this same function.
|
|
10
11
|
*
|
|
11
|
-
* Returns the control stream
|
|
12
|
+
* Returns the control stream, the uni streams that arrived before it (see
|
|
13
|
+
* {@link receiveSetup}), plus what the peer's SETUP declared: whether it requires
|
|
12
14
|
* solicitation, which decides whether we announce namespaces unprompted (see the MoQ Solicit
|
|
13
15
|
* extension), and its Hop ID (see the MoQ Cluster extension). We declare both ourselves on
|
|
14
16
|
* every session: we send SUBSCRIBE_NAMESPACE for each prefix we want, so an unsolicited
|
|
@@ -32,6 +34,7 @@ export async function exchangeSetup(transport, version, implementation) {
|
|
|
32
34
|
]);
|
|
33
35
|
return {
|
|
34
36
|
control: new Stream({ writer, reader: received.reader }),
|
|
37
|
+
early: received.early,
|
|
35
38
|
solicit: received.solicit,
|
|
36
39
|
hidden: received.hidden,
|
|
37
40
|
cluster: { self, peer: received.cluster },
|
|
@@ -45,20 +48,49 @@ async function sendSetup(transport, version, setupMsg) {
|
|
|
45
48
|
await setupMsg.encode(writer, version);
|
|
46
49
|
return writer;
|
|
47
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* Read the peer's SETUP off its uni stream. Any other uni stream that beats it (padding,
|
|
53
|
+
* or group data for a subscription the peer already holds) is held, type unread, for the
|
|
54
|
+
* session to classify once it starts: the drafts say to buffer early data rather than
|
|
55
|
+
* reject it. QUIC stream credit bounds how many can pile up.
|
|
56
|
+
*/
|
|
48
57
|
async function receiveSetup(transport, version) {
|
|
49
58
|
const uniReader = transport.incomingUnidirectionalStreams.getReader();
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
59
|
+
const early = [];
|
|
60
|
+
let reader;
|
|
61
|
+
try {
|
|
62
|
+
for (;;) {
|
|
63
|
+
const next = await uniReader.read();
|
|
64
|
+
if (next.done)
|
|
65
|
+
throw new Error("no incoming uni stream for SETUP");
|
|
66
|
+
const stream = new Reader(next.value, undefined, version);
|
|
67
|
+
// A stream that ended or reset before its full type is that stream's failure, not the session's.
|
|
68
|
+
// Malformed bytes are still the peer's fault, so a bad type fails the handshake.
|
|
69
|
+
if (await stream.done().catch(() => true))
|
|
70
|
+
continue;
|
|
71
|
+
// Full width, so an unknown type past 2^53 is held for the classifier to refuse.
|
|
72
|
+
const streamType = await stream.peekU62().catch((err) => {
|
|
73
|
+
if (err instanceof StreamError || err instanceof UnexpectedEnd)
|
|
74
|
+
return undefined;
|
|
75
|
+
throw err;
|
|
76
|
+
});
|
|
77
|
+
if (streamType === undefined)
|
|
78
|
+
continue;
|
|
79
|
+
if (streamType === BigInt(Ietf.Setup.id)) {
|
|
80
|
+
reader = stream;
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
83
|
+
early.push(stream);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
finally {
|
|
87
|
+
uniReader.releaseLock();
|
|
58
88
|
}
|
|
89
|
+
await reader.u53(); // the SETUP type, peeked above
|
|
59
90
|
const setup = await Ietf.Setup.decode(reader, version);
|
|
60
91
|
return {
|
|
61
92
|
reader,
|
|
93
|
+
early,
|
|
62
94
|
solicit: Ietf.solicitFromSetup(setup.parameters),
|
|
63
95
|
hidden: Ietf.hiddenFromSetup(setup.parameters),
|
|
64
96
|
cluster: Ietf.Cluster.fromSetup(setup.parameters, version),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handshake.js","sourceRoot":"","sources":["../../src/connection/handshake.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,SAAS,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,KAAK,IAAI,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"handshake.js","sourceRoot":"","sources":["../../src/connection/handshake.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAY,SAAS,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,KAAK,IAAI,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAErE;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAClC,SAAuB,EACvB,OAAyB,EACzB,cAAsB;IAQtB,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;IAClC,MAAM,MAAM,GA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M,CAAC,CAAC;QACpB,CAAC;IACF,CAAC;YAAS,CAAC;QACV,SAAS,CAAC,WAAW,EAAE,CAAC;IACzB,CAAC;IAED,MAAM,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,+BAA+B;IACnD,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEvD,OAAO;QACN,MAAM;QACN,KAAK;QACL,OAAO,EAAE,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,UAAU,CAAC;QAChD,MAAM,EAAE,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,UAAU,CAAC;QAC9C,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,UAAU,EAAE,OAAO,CAAC;KAC1D,CAAC;AACH,CAAC","sourcesContent":["import { StreamError } from \"../error.ts\";\nimport { type Hop, randomHop } from \"../hop.ts\";\nimport * as Ietf from \"../ietf/index.ts\";\nimport { Reader, Stream, UnexpectedEnd, Writer } from \"../stream.ts\";\n\n/**\n * Draft-17+ SETUP exchange. Each side opens a uni stream, writes its Setup\n * message, and reads the peer's Setup off an incoming uni stream. The two\n * halves run in parallel and the protocol is symmetric, so both `connect`\n * (client) and `accept` (server) use this same function.\n *\n * Returns the control stream, the uni streams that arrived before it (see\n * {@link receiveSetup}), plus what the peer's SETUP declared: whether it requires\n * solicitation, which decides whether we announce namespaces unprompted (see the MoQ Solicit\n * extension), and its Hop ID (see the MoQ Cluster extension). We declare both ourselves on\n * every session: we send SUBSCRIBE_NAMESPACE for each prefix we want, so an unsolicited\n * advertisement can tell us nothing we won't have asked for, and a peer that knows our Hop\n * ID can withhold the advertisements that already flowed through us.\n */\nexport async function exchangeSetup(\n\ttransport: WebTransport,\n\tversion: Ietf.IetfVersion,\n\timplementation: string,\n): Promise<{\n\tcontrol: Stream;\n\tearly: Reader[];\n\tsolicit: boolean | undefined;\n\thidden: boolean;\n\tcluster: Ietf.Cluster.Hops;\n}> {\n\tconst encoder = new TextEncoder();\n\tconst params = new Ietf.SetupOptions();\n\tparams.setBytes(Ietf.SetupOption.Implementation, encoder.encode(implementation));\n\tIetf.solicitIntoSetup(params);\n\tIetf.hiddenIntoSetup(params);\n\n\t// One id per session, like the moq-lite connection: nothing in this process forwards\n\t// between sessions, so there is nothing for a shared id to detect.\n\tconst self = randomHop();\n\tIetf.Cluster.intoSetup(params, self, version);\n\n\tconst setupMsg = new Ietf.Setup({ parameters: params });\n\n\tconst [writer, received] = await Promise.all([\n\t\tsendSetup(transport, version, setupMsg),\n\t\treceiveSetup(transport, version),\n\t]);\n\n\treturn {\n\t\tcontrol: new Stream({ writer, reader: received.reader }),\n\t\tearly: received.early,\n\t\tsolicit: received.solicit,\n\t\thidden: received.hidden,\n\t\tcluster: { self, peer: received.cluster },\n\t};\n}\n\nasync function sendSetup(transport: WebTransport, version: Ietf.IetfVersion, setupMsg: Ietf.Setup): Promise<Writer> {\n\t// Via Writer.open for its deadline: a peer can advertise a stream limit of zero and\n\t// never raise it, which would otherwise hang the handshake rather than failing it.\n\tconst writer = await Writer.open(transport, { version });\n\tawait writer.u53(Ietf.Setup.id); // 0x2F00 stream type\n\tawait setupMsg.encode(writer, version);\n\treturn writer;\n}\n\n/**\n * Read the peer's SETUP off its uni stream. Any other uni stream that beats it (padding,\n * or group data for a subscription the peer already holds) is held, type unread, for the\n * session to classify once it starts: the drafts say to buffer early data rather than\n * reject it. QUIC stream credit bounds how many can pile up.\n */\nasync function receiveSetup(\n\ttransport: WebTransport,\n\tversion: Ietf.IetfVersion,\n): Promise<{\n\treader: Reader;\n\tearly: Reader[];\n\tsolicit: boolean | undefined;\n\thidden: boolean;\n\tcluster: Hop | undefined;\n}> {\n\tconst uniReader = transport.incomingUnidirectionalStreams.getReader() as ReadableStreamDefaultReader<\n\t\tReadableStream<Uint8Array>\n\t>;\n\tconst early: Reader[] = [];\n\n\tlet reader: Reader;\n\ttry {\n\t\tfor (;;) {\n\t\t\tconst next = await uniReader.read();\n\t\t\tif (next.done) throw new Error(\"no incoming uni stream for SETUP\");\n\n\t\t\tconst stream = new Reader(next.value, undefined, version);\n\t\t\t// A stream that ended or reset before its full type is that stream's failure, not the session's.\n\t\t\t// Malformed bytes are still the peer's fault, so a bad type fails the handshake.\n\t\t\tif (await stream.done().catch(() => true)) continue;\n\t\t\t// Full width, so an unknown type past 2^53 is held for the classifier to refuse.\n\t\t\tconst streamType = await stream.peekU62().catch((err: unknown) => {\n\t\t\t\tif (err instanceof StreamError || err instanceof UnexpectedEnd) return undefined;\n\t\t\t\tthrow err;\n\t\t\t});\n\t\t\tif (streamType === undefined) continue;\n\t\t\tif (streamType === BigInt(Ietf.Setup.id)) {\n\t\t\t\treader = stream;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tearly.push(stream);\n\t\t}\n\t} finally {\n\t\tuniReader.releaseLock();\n\t}\n\n\tawait reader.u53(); // the SETUP type, peeked above\n\tconst setup = await Ietf.Setup.decode(reader, version);\n\n\treturn {\n\t\treader,\n\t\tearly,\n\t\tsolicit: Ietf.solicitFromSetup(setup.parameters),\n\t\thidden: Ietf.hiddenFromSetup(setup.parameters),\n\t\tcluster: Ietf.Cluster.fromSetup(setup.parameters, version),\n\t};\n}\n"]}
|
package/connection/pool.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ import { type AcceptProps as AcceptPropsType, accept } from "./accept";
|
|
|
13
13
|
import { isWebTransportSupported } from "./browser";
|
|
14
14
|
import { type CertificateHash as CertificateHashType, type ConnectProps as ConnectPropsType, certificateHash, connect, type WebSocketProps as WebSocketPropsType, type WebTransportProps as WebTransportPropsType } from "./connect";
|
|
15
15
|
import type { Established as EstablishedType } from "./established";
|
|
16
|
+
import type { GoawayProps, Redirect as RedirectType } from "./goaway";
|
|
16
17
|
import { type ReloadDelay, type ReloadStatus } from "./reload";
|
|
17
18
|
import type { Probe as ProbeType, Stats as StatsType } from "./stats";
|
|
18
19
|
import type { Transport as TransportType } from "./transport";
|
|
@@ -48,6 +49,12 @@ export interface ConnectionProps {
|
|
|
48
49
|
consume?: Origin.Producer;
|
|
49
50
|
/** Backoff settings for the reconnect loop; an unset field uses its default. */
|
|
50
51
|
delay?: ReloadDelay;
|
|
52
|
+
/**
|
|
53
|
+
* How to react to the relay's GOAWAY; an unset field uses its default. Every connection
|
|
54
|
+
* migrates on GOAWAY, dialing the replacement while the old session finishes its groups.
|
|
55
|
+
* This only tunes where it may go and for how long the old session serves.
|
|
56
|
+
*/
|
|
57
|
+
goaway?: GoawayProps;
|
|
51
58
|
/** A Connection owns the abort signal for each connection attempt. */
|
|
52
59
|
signal?: never;
|
|
53
60
|
/** A one-shot transport cannot be reused by the reconnect loop; call {@link Connection.connect} instead. */
|
|
@@ -70,7 +77,11 @@ export interface ConnectionProps {
|
|
|
70
77
|
* connection so the next handle dials fresh; a new URL on this handle starts another
|
|
71
78
|
* sequence. {@link closed} settles only when this handle is released.
|
|
72
79
|
*
|
|
73
|
-
*
|
|
80
|
+
* A relay's GOAWAY migrates rather than drops: the replacement dials at once while the old
|
|
81
|
+
* session finishes its groups, and the handle and its origin carry across. A redirect the
|
|
82
|
+
* {@link ConnectionProps.goaway} policy refuses stops the loop like an auth rejection does.
|
|
83
|
+
*
|
|
84
|
+
* Options the pool cannot honor (transport options, discovery, delay, goaway, a pinned
|
|
74
85
|
* certificate, caller-owned origins) use a private loop. An explicit `share: true`
|
|
75
86
|
* refuses them. A supplied transport cannot reconnect at all; pass it to {@link Connection.connect}
|
|
76
87
|
* instead.
|
|
@@ -166,6 +177,10 @@ export declare namespace Connection {
|
|
|
166
177
|
type AcceptProps = AcceptPropsType;
|
|
167
178
|
/** Backoff settings for a private reconnect loop. */
|
|
168
179
|
type Backoff = ReloadDelay;
|
|
180
|
+
/** How a connection reacts to the relay's GOAWAY. */
|
|
181
|
+
type Goaway = GoawayProps;
|
|
182
|
+
/** What to do with the URI a relay names in its GOAWAY. */
|
|
183
|
+
type Redirect = RedirectType;
|
|
169
184
|
/** Current state of a {@link Connection}. */
|
|
170
185
|
type Status = ReloadStatus;
|
|
171
186
|
/** The current connection's PROBE estimates. */
|
package/connection/pool.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pool.d.ts","sourceRoot":"","sources":["../../src/connection/pool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAU,KAAK,UAAU,EAAE,KAAK,MAAM,EAAQ,MAAM,EAAE,MAAM,cAAc,CAAC;AAClF,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,KAAK,MAAM,MAAM,cAAc,CAAC;AACvC,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AACnC,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,KAAK,WAAW,IAAI,eAAe,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1E,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EACN,KAAK,eAAe,IAAI,mBAAmB,EAC3C,KAAK,YAAY,IAAI,gBAAgB,EACrC,eAAe,EACf,OAAO,EACP,KAAK,cAAc,IAAI,kBAAkB,EACzC,KAAK,iBAAiB,IAAI,qBAAqB,EAC/C,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,WAAW,IAAI,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAU,KAAK,WAAW,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAC1E,OAAO,KAAK,EAAE,KAAK,IAAI,SAAS,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,YAAY,CAAC;AACzE,OAAO,KAAK,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAKjE,sCAAsC;AACtC,MAAM,WAAW,eAAe;IAC/B,sEAAsE;IACtE,G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@ const LINGER_MS = Time.Milli(2000);
|
|
|
32
32
|
* connection so the next handle dials fresh; a new URL on this handle starts another
|
|
33
33
|
* sequence. {@link closed} settles only when this handle is released.
|
|
34
34
|
*
|
|
35
|
-
*
|
|
35
|
+
* A relay's GOAWAY migrates rather than drops: the replacement dials at once while the old
|
|
36
|
+
* session finishes its groups, and the handle and its origin carry across. A redirect the
|
|
37
|
+
* {@link ConnectionProps.goaway} policy refuses stops the loop like an auth rejection does.
|
|
38
|
+
*
|
|
39
|
+
* Options the pool cannot honor (transport options, discovery, delay, goaway, a pinned
|
|
36
40
|
* certificate, caller-owned origins) use a private loop. An explicit `share: true`
|
|
37
41
|
* refuses them. A supplied transport cannot reconnect at all; pass it to {@link Connection.connect}
|
|
38
42
|
* instead.
|
|
@@ -164,6 +168,7 @@ export class Connection {
|
|
|
164
168
|
// A handle nobody watches wants unlimited retries; an auth rejection still
|
|
165
169
|
// stops this URL, and a new one starts another sequence.
|
|
166
170
|
delay: { timeout: Time.Milli(0), ...props.delay },
|
|
171
|
+
goaway: props.goaway,
|
|
167
172
|
});
|
|
168
173
|
this.#signals.cleanup(() => loop.close());
|
|
169
174
|
this.#signals.run((effect) => {
|
|
@@ -274,6 +279,9 @@ function refuse(props) {
|
|
|
274
279
|
if (props.delay !== undefined) {
|
|
275
280
|
throw new Error("delay cannot be shared; pass share: false");
|
|
276
281
|
}
|
|
282
|
+
if (props.goaway !== undefined) {
|
|
283
|
+
throw new Error("goaway cannot be shared; pass share: false");
|
|
284
|
+
}
|
|
277
285
|
}
|
|
278
286
|
/** Options tied to one handle cannot be represented by a URL-keyed shared entry. */
|
|
279
287
|
function requiresPrivate(props) {
|
|
@@ -281,6 +289,7 @@ function requiresPrivate(props) {
|
|
|
281
289
|
props.websocket !== undefined ||
|
|
282
290
|
props.discovery !== undefined ||
|
|
283
291
|
props.delay !== undefined ||
|
|
292
|
+
props.goaway !== undefined ||
|
|
284
293
|
props.publish !== undefined ||
|
|
285
294
|
props.consume !== undefined);
|
|
286
295
|
}
|
|
@@ -301,14 +310,27 @@ function acquire(key, linger) {
|
|
|
301
310
|
// instead; an auth rejection still stops this URL, and evicts below.
|
|
302
311
|
delay: { timeout: Time.Milli(0) },
|
|
303
312
|
});
|
|
304
|
-
const created = { origin, connection, refs: 0, linger: linger ?? LINGER_MS };
|
|
305
|
-
// The loop only stops on a peer saying these credentials will never work
|
|
306
|
-
// entry so a later handle dials fresh rather
|
|
307
|
-
// handles already on it keep it until they
|
|
308
|
-
//
|
|
313
|
+
const created = { key, origin, connection, refs: 0, linger: linger ?? LINGER_MS };
|
|
314
|
+
// The loop only stops on a peer saying these credentials will never work, or on a
|
|
315
|
+
// GOAWAY redirect it refused. Drop the entry so a later handle dials fresh rather
|
|
316
|
+
// than joining a loop that has stopped; handles already on it keep it until they
|
|
317
|
+
// release.
|
|
309
318
|
connection.error.subscribe((err) => {
|
|
310
|
-
if (err !== undefined && pool.get(key) === created)
|
|
311
|
-
pool.delete(key);
|
|
319
|
+
if (err !== undefined && pool.get(created.key) === created)
|
|
320
|
+
pool.delete(created.key);
|
|
321
|
+
});
|
|
322
|
+
// An accepted redirect moves the entry to the URL it now dials, so a later handle
|
|
323
|
+
// configured with that URL shares it, and one asking for the old URL dials fresh.
|
|
324
|
+
// A live entry already at the target wins: this one leaves the pool and serves only
|
|
325
|
+
// the handles it has until they release it.
|
|
326
|
+
connection.redirect.subscribe((redirect) => {
|
|
327
|
+
if (!redirect || redirect.href === created.key)
|
|
328
|
+
return;
|
|
329
|
+
if (pool.get(created.key) === created)
|
|
330
|
+
pool.delete(created.key);
|
|
331
|
+
created.key = redirect.href;
|
|
332
|
+
if (!pool.has(created.key))
|
|
333
|
+
pool.set(created.key, created);
|
|
312
334
|
});
|
|
313
335
|
entry = created;
|
|
314
336
|
pool.set(key, created);
|
|
@@ -331,8 +353,8 @@ function acquire(key, linger) {
|
|
|
331
353
|
if (taken.refs > 0)
|
|
332
354
|
return;
|
|
333
355
|
taken.timer = setTimeout(() => {
|
|
334
|
-
if (pool.get(key) === taken)
|
|
335
|
-
pool.delete(key);
|
|
356
|
+
if (pool.get(taken.key) === taken)
|
|
357
|
+
pool.delete(taken.key);
|
|
336
358
|
taken.connection.close();
|
|
337
359
|
taken.origin.close();
|
|
338
360
|
}, taken.linger);
|
package/connection/pool.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pool.js","sourceRoot":"","sources":["../../src/connection/pool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,MAAM,EAAgC,IAAI,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAClF,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAE5C,OAAO,KAAK,MAAM,MAAM,cAAc,CAAC;AACvC,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AACnC,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AACnC,OAAO,EAAuC,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1E,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAGN,eAAe,EACf,OAAO,GAGP,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,MAAM,EAAuC,MAAM,aAAa,CAAC;AAI1E,oFAAoF;AACpF,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AAmDnC;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,OAAO,UAAU;IACtB,kGAAkG;IAClG,MAAM,CAAU,OAAO,GAAG,OAAO,CAAC;IAElC,8DAA8D;IAC9D,MAAM,CAAU,MAAM,GAAG,MAAM,CAAC;IAEhC,wFAAwF;IACxF,MAAM,CAAU,eAAe,GAAG,eAAe,CAAC;IAElD,0DAA0D;IAC1D,MAAM,CAAU,uBAAuB,GAAG,uBAAuB,CAAC;IAElE,mEAAmE;IACnE,GAAG,CAA0B;IAE7B,qFAAqF;IACrF,OAAO,CAAkB;IAEzB,wCAAw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,UAAU,CAAC,KAAK,EAAE,CAAC;gBACzB,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;YACtB,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;YAEjB,mEAAmE;YAClE,KAAK,CAAC,KAAgC,CAAC,KAAK,EAAE,EAAE,CAAC;QACnD,CAAC;KACD,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,WAAW;IAC1B,MAAM,OAAO,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;IACnC,IAAI,CAAC,KAAK,EAAE,CAAC;IACb,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC7B,IAAI,KAAK,CAAC,KAAK,KAAK,SAAS;YAAE,YAAY,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACzD,KAAK,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;QACzB,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;IACtB,CAAC;AACF,CAAC","sourcesContent":["/**\n * A reconnecting, shareable connection: one origin and one reconnect loop per relay URL.\n *\n * @module\n */\nimport { Effect, type GetPromise, type Getter, Once, Signal } from \"@moq/signals\";\nimport * as Announce from \"../announced.ts\";\nimport type { Handle } from \"../bandwidth.ts\";\nimport * as Origin from \"../origin.ts\";\nimport * as Path from \"../path.ts\";\nimport * as Time from \"../time.ts\";\nimport { type AcceptProps as AcceptPropsType, accept } from \"./accept.ts\";\nimport { isWebTransportSupported } from \"./browser.ts\";\nimport {\n\ttype CertificateHash as CertificateHashType,\n\ttype ConnectProps as ConnectPropsType,\n\tcertificateHash,\n\tconnect,\n\ttype WebSocketProps as WebSocketPropsType,\n\ttype WebTransportProps as WebTransportPropsType,\n} from \"./connect.ts\";\nimport type { Established as EstablishedType } from \"./established.ts\";\nimport { Reload, type ReloadDelay, type ReloadStatus } from \"./reload.ts\";\nimport type { Probe as ProbeType, Stats as StatsType } from \"./stats.ts\";\nimport type { Transport as TransportType } from \"./transport.ts\";\n\n/** How long an unreferenced shared connection lingers before it actually closes. */\nconst LINGER_MS = Time.Milli(2000);\n\n/** Options for {@link Connection}. */\nexport interface ConnectionProps {\n\t/** The relay to connect to; pass a `Signal` to switch relays live. */\n\turl?: URL | Signal<URL | undefined>;\n\n\t/** Whether to connect at all (default: true); pass a `Signal` to toggle live. */\n\tenabled?: boolean | Signal<boolean>;\n\n\t/**\n\t * How long the underlying connection outlives its last handle (default: 2000ms).\n\t *\n\t * The window is what makes moving an element around the DOM free: the connection and\n\t * everything it discovered are still warm when the new owner asks for them. The longest\n\t * linger requested by any handle sharing the connection wins.\n\t */\n\tlinger?: Time.Milli;\n\n\t/**\n\t * Share a pooled transport keyed on the URL. By default, options specific to this\n\t * handle use a private reconnect loop; otherwise connections share by URL.\n\t * Explicit `true` refuses options a pool cannot honor.\n\t */\n\tshare?: boolean;\n\n\t/** WebTransport options applied to each connection attempt (not reactive). */\n\twebtransport?: WebTransportPropsType;\n\n\t/** WebSocket fallback options applied to each connection attempt (not reactive). */\n\twebsocket?: WebSocketPropsType;\n\n\t/** Whether the relay supports broadcast discovery. */\n\tdiscovery?: boolean;\n\n\t/** The origin whose broadcasts are served, spanning reconnects. Implies a private loop. */\n\tpublish?: Origin.Consumer;\n\n\t/** The origin fed with the peer's announced broadcasts, spanning reconnects. Implies a private loop. */\n\tconsume?: Origin.Producer;\n\n\t/** Backoff settings for the reconnect loop; an unset field uses its default. */\n\tdelay?: ReloadDelay;\n\n\t/** A Connection 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; call {@link Connection.connect} instead. */\n\ttransport?: never;\n}\n\n/**\n * A cloneable handle on a MoQ connection: `new Connection({ url })` reconnects and, by\n * default, shares one origin and one reconnect loop with every other handle on that URL.\n *\n * The shared {@link origin} is wired to both directions. Everything the relay announces\n * lands in it, a publish into it is announced to the relay, and a page that publishes and\n * watches the same path resolves it locally with no round trip.\n *\n * {@link close} releases this handle; the connection survives its last handle by a short\n * linger window (see {@link ConnectionProps.linger}), so a component torn down and rebuilt\n * reuses the warm connection instead of redialing.\n *\n * The loop reconnects for as long as a handle holds it, so an outage of any length recovers\n * on its own. An auth rejection stops retrying those credentials and retires the shared\n * connection so the next handle dials fresh; a new URL on this handle starts another\n * sequence. {@link closed} settles only when this handle is released.\n *\n * Options the pool cannot honor (transport options, discovery, delay, a pinned\n * certificate, caller-owned origins) use a private loop. An explicit `share: true`\n * refuses them. A supplied transport cannot reconnect at all; pass it to {@link Connection.connect}\n * instead.\n *\n * @public\n */\nexport class Connection {\n\t/** Establish a one-shot session; a supplied transport belongs here, not in the reconnect loop. */\n\tstatic readonly connect = connect;\n\n\t/** Accept a one-shot session on an already-open transport. */\n\tstatic readonly accept = accept;\n\n\t/** SHA-256 of a certificate, for pinning via `webtransport.serverCertificateHashes`. */\n\tstatic readonly certificateHash = certificateHash;\n\n\t/** Whether this runtime can connect with WebTransport. */\n\tstatic readonly isWebTransportSupported = isWebTransportSupported;\n\n\t/** Relay URL to connect to; updating it reconnects to that URL. */\n\turl: Signal<URL | undefined>;\n\n\t/** Whether to hold a connection at all; clearing it releases this handle's share. */\n\tenabled: Signal<boolean>;\n\n\t/** Current status of the connection. */\n\treadonly status: Getter<ReloadStatus>;\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 a private retry window expires. Cleared when a new URL\n\t * or a disable/re-enable starts another sequence, not on a page hide/show.\n\t */\n\treadonly error: Getter<Error | undefined>;\n\n\t/**\n\t * The wire transport the current session runs over, or undefined while disconnected.\n\t *\n\t * The session itself is deliberately not exposed: it is shared, so no handle may close\n\t * or reconfigure it, and everything else it offers is reachable through {@link origin}.\n\t */\n\treadonly transport: Getter<TransportType | undefined>;\n\n\t/** The current connection's PROBE estimates, or undefined while disconnected. */\n\treadonly probe: Getter<ProbeType | undefined>;\n\n\t/**\n\t * The send-side bandwidth allocator for the current URL, or undefined\n\t * while disabled or URL-less.\n\t *\n\t * Every handle on this URL shares the same instance, so publishers reserve\n\t * against one registry. Borrowed, not owned: the type has no close, since\n\t * closing it would starve every other handle.\n\t */\n\treadonly bandwidth: Getter<Handle | undefined>;\n\n\t/**\n\t * The origin for the current URL, or undefined while disabled or URL-less.\n\t *\n\t * Publish into it or consume from it; a shared handle's origin is the same one every\n\t * other handle on this URL uses, and it spans the connection's reconnects. Borrowed,\n\t * not owned: the type has no close, since closing it would tear the origin down under\n\t * every other handle.\n\t */\n\treadonly origin: Getter<Origin.Table | undefined>;\n\n\t/**\n\t * Settles once this handle is released via {@link close}: `null` on a clean close, or\n\t * the abort {@link Error}. Peek it synchronously (`undefined` while open), observe it\n\t * reactively, or `await` it. Attempt failures live on {@link 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\treadonly #status = new Signal<ReloadStatus>(\"disconnected\");\n\treadonly #established = new Signal<EstablishedType | undefined>(undefined);\n\treadonly #probe = new Signal<ProbeType | undefined>(undefined);\n\treadonly #origin = new Signal<Origin.Producer | undefined>(undefined);\n\treadonly #bandwidth = new Signal<Handle | undefined>(undefined);\n\treadonly #error = new Signal<Error | undefined>(undefined);\n\t#signals: Effect;\n\n\t/**\n\t * Take a handle on the connection for {@link ConnectionProps.url}.\n\t *\n\t * Dials immediately when a URL is given and `enabled` is not false; otherwise waits for\n\t * the signals to say go. The handle owns nothing but its own share: {@link close}\n\t * releases it, and the underlying connection and origin live for as long as any handle\n\t * (plus the linger window) wants them.\n\t */\n\tconstructor(props?: ConnectionProps) {\n\t\trefuse(props);\n\t\tthis.#signals = new Effect();\n\n\t\tthis.url = Signal.from(props?.url);\n\t\tthis.enabled = Signal.from(props?.enabled ?? true);\n\t\tthis.status = this.#status;\n\t\tthis.error = this.#error;\n\t\tthis.probe = this.#probe;\n\t\tthis.origin = this.#origin;\n\t\tthis.bandwidth = this.#bandwidth;\n\t\tthis.transport = this.#signals.computed((effect) => effect.get(this.#established)?.transport);\n\n\t\tconst linger = props?.linger;\n\n\t\t// Key on the serialized URL: URL objects use identity equality, and an equivalent\n\t\t// instance must not release and redial.\n\t\tconst href = this.#signals.computed((effect) => effect.get(this.url)?.href);\n\n\t\tif (props && (props.share === false || requiresPrivate(props))) {\n\t\t\tthis.#runPrivate(props, href);\n\t\t\treturn;\n\t\t}\n\n\t\tthis.#signals.run((effect) => {\n\t\t\tif (!effect.get(this.enabled)) return;\n\t\t\tconst key = effect.get(href);\n\t\t\tif (!key) return;\n\n\t\t\tconst lease = acquire(key, linger);\n\t\t\teffect.cleanup(lease.release);\n\n\t\t\teffect.set(this.#origin, lease.origin, undefined);\n\t\t\teffect.set(this.#bandwidth, lease.connection.bandwidth, undefined);\n\n\t\t\t// Proxy the shared loop's outputs, so this handle reads like its own connection.\n\t\t\teffect.run((nested) => nested.set(this.#status, nested.get(lease.connection.status), \"disconnected\"));\n\t\t\teffect.run((nested) => nested.set(this.#established, nested.get(lease.connection.established), undefined));\n\t\t\teffect.run((nested) => nested.set(this.#probe, nested.get(lease.connection.probe), undefined));\n\t\t\teffect.run((nested) => nested.set(this.#error, nested.get(lease.connection.error), undefined));\n\t\t});\n\t}\n\n\t#runPrivate(props: ConnectionProps, href: Getter<string | undefined>): void {\n\t\tconst owned = props.consume === undefined;\n\t\tconst origin = props.consume ?? new Origin.Producer();\n\t\tif (owned) this.#signals.cleanup(() => origin.close());\n\n\t\tconst loop = new Reload({\n\t\t\turl: this.url,\n\t\t\tenabled: this.enabled,\n\t\t\tpublish: props.publish ?? (owned ? origin.consume() : undefined),\n\t\t\tconsume: origin,\n\t\t\twebtransport: props.webtransport,\n\t\t\twebsocket: props.websocket,\n\t\t\tdiscovery: props.discovery,\n\t\t\t// A handle nobody watches wants unlimited retries; an auth rejection still\n\t\t\t// stops this URL, and a new one starts another sequence.\n\t\t\tdelay: { timeout: Time.Milli(0), ...props.delay },\n\t\t});\n\t\tthis.#signals.cleanup(() => loop.close());\n\n\t\tthis.#signals.run((effect) => {\n\t\t\tif (!effect.get(this.enabled) || !effect.get(href)) return;\n\t\t\teffect.set(this.#origin, origin, undefined);\n\t\t\teffect.set(this.#bandwidth, loop.bandwidth, undefined);\n\t\t});\n\t\tthis.#signals.run((effect) => effect.set(this.#status, effect.get(loop.status), \"disconnected\"));\n\t\tthis.#signals.run((effect) => effect.set(this.#established, effect.get(loop.established), undefined));\n\t\tthis.#signals.run((effect) => effect.set(this.#probe, effect.get(loop.probe), undefined));\n\t\tthis.#signals.run((effect) => effect.set(this.#error, effect.get(loop.error), undefined));\n\t}\n\n\t/**\n\t * Subscribe to broadcast announcements matching `scope`, spanning reconnects\n\t * and URL switches: a switch retracts everything from\n\t * the old relay's origin, then the new one's arrivals stream in.\n\t */\n\tannounced(scope: Path.Pattern = Path.Pattern.all(), options?: Announce.Options): Announce.Consumer {\n\t\tconst producer = new Announce.Producer();\n\t\tconst consumer = producer.consume();\n\n\t\t// Closing the consumer closes the shared state, so stop appending after that.\n\t\tlet closed = false;\n\t\tvoid consumer.closed.then(() => {\n\t\t\tclosed = true;\n\t\t});\n\n\t\t// A child of this handle's scope rather than a standalone Effect it merely cleans up\n\t\t// after: the disposer run() hands back also drops itself from the parent, so opening\n\t\t// and closing announcement streams repeatedly does not pile up dead pumps that live\n\t\t// until the whole handle closes.\n\t\tconst stop = this.#signals.run((effect) => {\n\t\t\tconst origin = effect.get(this.#origin);\n\t\t\tif (!origin) return;\n\n\t\t\tconst upstream = origin.announced(scope, options);\n\t\t\teffect.cleanup(() => upstream.close());\n\n\t\t\t// Track what this origin announced so a URL switch retracts it; the last\n\t\t\t// 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} finally {\n\t\t\t\t\tif (!closed) {\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\tvoid consumer.closed.then(stop);\n\n\t\treturn consumer;\n\t}\n\n\t/** Snapshot the live connection's transport counters, or undefined while disconnected. */\n\tasync stats(): Promise<StatsType | undefined> {\n\t\treturn this.#established.peek()?.stats();\n\t}\n\n\t/**\n\t * Release this handle. The shared connection closes once its last handle is gone and\n\t * the linger window passes; other handles on the URL are unaffected. Idempotent.\n\t */\n\tclose(abort?: Error): void {\n\t\tthis.#signals.close();\n\t\tif (this.#closed.peek() === undefined) this.#closed.set(abort ?? null);\n\t}\n}\n\n/** Types on {@link Connection}: the handle is the class, these are its associated types. */\nexport namespace Connection {\n\t/** Options for {@link Connection}. */\n\texport type Props = ConnectionProps;\n\t/** Options for {@link Connection.connect}. */\n\texport type ConnectProps = ConnectPropsType;\n\t/** Options for {@link Connection.accept}. */\n\texport type AcceptProps = AcceptPropsType;\n\t/** Backoff settings for a private reconnect loop. */\n\texport type Backoff = ReloadDelay;\n\t/** Current state of a {@link Connection}. */\n\texport type Status = ReloadStatus;\n\t/** The current connection's PROBE estimates. */\n\texport type Probe = ProbeType;\n\t/** A point-in-time snapshot of the transport's counters. */\n\texport type Stats = StatsType;\n\t/** The wire transport a session runs over. */\n\texport type Transport = TransportType;\n\t/** Tuning for the WebSocket fallback. */\n\texport type WebSocketProps = WebSocketPropsType;\n\t/** WebTransport options, including friendlier certificate pinning. */\n\texport type WebTransportProps = WebTransportPropsType;\n\t/** A server certificate hash used to pin a self-signed server. */\n\texport type CertificateHash = CertificateHashType;\n\t/** An established one-shot session. */\n\texport type Established = EstablishedType;\n}\n\n/** Throw if `props` cannot be honored, rather than silently dropping them. */\nfunction refuse(props?: ConnectionProps): void {\n\tif (!props) return;\n\n\tconst extra = props as ConnectionProps & { transport?: unknown; signal?: unknown };\n\tif (extra.transport) {\n\t\tthrow new Error(\"a supplied transport cannot reconnect; call Connection.connect() instead\");\n\t}\n\tif (extra.signal) {\n\t\tthrow new Error(\"a Connection owns its abort signal; do not pass one\");\n\t}\n\tif (props.share !== true || !requiresPrivate(props)) return;\n\n\tif (props.publish || props.consume) {\n\t\tthrow new Error(\"caller-owned origins cannot be shared; pass share: false\");\n\t}\n\tconst hashes = props.webtransport?.serverCertificateHashes?.length ?? 0;\n\tif (props.webtransport?.serverCertificate !== undefined || hashes > 0) {\n\t\tthrow new Error(\"a pinned certificate cannot be shared; pass share: false\");\n\t}\n\tif (props.webtransport !== undefined) {\n\t\tthrow new Error(\"webtransport options cannot be shared; pass share: false\");\n\t}\n\tif (props.websocket !== undefined) {\n\t\tthrow new Error(\"websocket options cannot be shared; pass share: false\");\n\t}\n\tif (props.discovery !== undefined) {\n\t\tthrow new Error(\"discovery cannot be shared; pass share: false\");\n\t}\n\tif (props.delay !== undefined) {\n\t\tthrow new Error(\"delay cannot be shared; pass share: false\");\n\t}\n}\n\n/** Options tied to one handle cannot be represented by a URL-keyed shared entry. */\nfunction requiresPrivate(props: ConnectionProps): boolean {\n\treturn (\n\t\tprops.webtransport !== undefined ||\n\t\tprops.websocket !== undefined ||\n\t\tprops.discovery !== undefined ||\n\t\tprops.delay !== undefined ||\n\t\tprops.publish !== undefined ||\n\t\tprops.consume !== undefined\n\t);\n}\n\n/** One shared connection and the handles keeping it alive. */\ninterface Entry {\n\torigin: Origin.Producer;\n\tconnection: Reload;\n\trefs: number;\n\tlinger: Time.Milli;\n\ttimer?: ReturnType<typeof setTimeout>;\n}\n\n/** The process-wide pool backing {@link Connection}. */\nconst pool = new Map<string, Entry>();\n\n/** Take a reference on the shared entry for `key`, creating it on first use. */\nfunction acquire(key: string, linger?: Time.Milli): Entry & { release: () => void } {\n\tlet entry = pool.get(key);\n\tif (!entry) {\n\t\tconst origin = new Origin.Producer();\n\t\tconst connection = new Reload({\n\t\t\turl: new URL(key),\n\t\t\tenabled: true,\n\t\t\tpublish: origin.consume(),\n\t\t\tconsume: origin,\n\t\t\t// Nobody observes a shared loop's `closed`, so giving up would strand every handle\n\t\t\t// on this URL offline until the page reloads. Retry for as long as the entry lives\n\t\t\t// instead; an auth rejection still stops this URL, and evicts below.\n\t\t\tdelay: { timeout: Time.Milli(0) },\n\t\t});\n\n\t\tconst created: Entry = { origin, connection, refs: 0, linger: linger ?? LINGER_MS };\n\n\t\t// The loop only stops on a peer saying these credentials will never work. Drop the\n\t\t// entry so a later handle dials fresh rather than joining a loop that has stopped;\n\t\t// handles already on it keep it until they release, since a redial would be refused\n\t\t// the same way.\n\t\tconnection.error.subscribe((err) => {\n\t\t\tif (err !== undefined && pool.get(key) === created) pool.delete(key);\n\t\t});\n\n\t\tentry = created;\n\t\tpool.set(key, created);\n\t}\n\n\tconst taken = entry;\n\ttaken.linger = Time.Milli(Math.max(taken.linger, linger ?? LINGER_MS));\n\ttaken.refs += 1;\n\tif (taken.timer !== undefined) {\n\t\tclearTimeout(taken.timer);\n\t\ttaken.timer = undefined;\n\t}\n\n\tlet released = false;\n\treturn {\n\t\t...taken,\n\t\trelease: () => {\n\t\t\tif (released) return;\n\t\t\treleased = true;\n\n\t\t\ttaken.refs -= 1;\n\t\t\tif (taken.refs > 0) return;\n\n\t\t\ttaken.timer = setTimeout(() => {\n\t\t\t\tif (pool.get(key) === taken) pool.delete(key);\n\t\t\t\ttaken.connection.close();\n\t\t\t\ttaken.origin.close();\n\t\t\t}, taken.linger);\n\n\t\t\t// Don't hold a Node process open for a connection nobody is using.\n\t\t\t(taken.timer as { unref?: () => void }).unref?.();\n\t\t},\n\t};\n}\n\n/**\n * Close every shared connection immediately, so the next handle dials fresh.\n *\n * Exists for tests, which otherwise share connections across cases.\n *\n * @internal\n */\nexport function resetShared(): void {\n\tconst entries = [...pool.values()];\n\tpool.clear();\n\tfor (const entry of entries) {\n\t\tif (entry.timer !== undefined) clearTimeout(entry.timer);\n\t\tentry.connection.close();\n\t\tentry.origin.close();\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"pool.js","sourceRoot":"","sources":["../../src/connection/pool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,MAAM,EAAgC,IAAI,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAClF,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAE5C,OAAO,KAAK,MAAM,MAAM,cAAc,CAAC;AACvC,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AACnC,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AACnC,OAAO,EAAuC,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1E,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAGN,eAAe,EACf,OAAO,GAGP,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,MAAM,EAAuC,MAAM,aAAa,CAAC;AAI1E,oFAAoF;AACpF,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AA0DnC;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,OAAO,UAAU;IACtB,kGAAkG;IAClG,MAAM,CAAU,OAAO,GAAG,OAAO,CAAC;IAElC,8DAA8D;IAC9D,MAAM,CAAU,MAAM,GAAG,MAAM,CAAC;IAEhC,wFAAwF;IACxF,MAAM,CAAU,eAAe,GAAG,eAAe,CAAC;IAElD,0DAA0D;IAC1D,MAAM,CAAU,uBAAuB,GAAG,uBAAuB,CAAC;IAElE,mEAAmE;IACnE,GAAG,CAA0B;IAE7B,qFAAqF;IACrF,OAAO,CAAkB;IAEzB,wCAAwC;IAC/B,MAAM,CAAuB;IAEtC;;;;;OAKG;IACM,KAAK,CAA4B;I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AAE,YAAY,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACzD,KAAK,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;QACzB,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;IACtB,CAAC;AACF,CAAC","sourcesContent":["/**\n * A reconnecting, shareable connection: one origin and one reconnect loop per relay URL.\n *\n * @module\n */\nimport { Effect, type GetPromise, type Getter, Once, Signal } from \"@moq/signals\";\nimport * as Announce from \"../announced.ts\";\nimport type { Handle } from \"../bandwidth.ts\";\nimport * as Origin from \"../origin.ts\";\nimport * as Path from \"../path.ts\";\nimport * as Time from \"../time.ts\";\nimport { type AcceptProps as AcceptPropsType, accept } from \"./accept.ts\";\nimport { isWebTransportSupported } from \"./browser.ts\";\nimport {\n\ttype CertificateHash as CertificateHashType,\n\ttype ConnectProps as ConnectPropsType,\n\tcertificateHash,\n\tconnect,\n\ttype WebSocketProps as WebSocketPropsType,\n\ttype WebTransportProps as WebTransportPropsType,\n} from \"./connect.ts\";\nimport type { Established as EstablishedType } from \"./established.ts\";\nimport type { GoawayProps, Redirect as RedirectType } from \"./goaway.ts\";\nimport { Reload, type ReloadDelay, type ReloadStatus } from \"./reload.ts\";\nimport type { Probe as ProbeType, Stats as StatsType } from \"./stats.ts\";\nimport type { Transport as TransportType } from \"./transport.ts\";\n\n/** How long an unreferenced shared connection lingers before it actually closes. */\nconst LINGER_MS = Time.Milli(2000);\n\n/** Options for {@link Connection}. */\nexport interface ConnectionProps {\n\t/** The relay to connect to; pass a `Signal` to switch relays live. */\n\turl?: URL | Signal<URL | undefined>;\n\n\t/** Whether to connect at all (default: true); pass a `Signal` to toggle live. */\n\tenabled?: boolean | Signal<boolean>;\n\n\t/**\n\t * How long the underlying connection outlives its last handle (default: 2000ms).\n\t *\n\t * The window is what makes moving an element around the DOM free: the connection and\n\t * everything it discovered are still warm when the new owner asks for them. The longest\n\t * linger requested by any handle sharing the connection wins.\n\t */\n\tlinger?: Time.Milli;\n\n\t/**\n\t * Share a pooled transport keyed on the URL. By default, options specific to this\n\t * handle use a private reconnect loop; otherwise connections share by URL.\n\t * Explicit `true` refuses options a pool cannot honor.\n\t */\n\tshare?: boolean;\n\n\t/** WebTransport options applied to each connection attempt (not reactive). */\n\twebtransport?: WebTransportPropsType;\n\n\t/** WebSocket fallback options applied to each connection attempt (not reactive). */\n\twebsocket?: WebSocketPropsType;\n\n\t/** Whether the relay supports broadcast discovery. */\n\tdiscovery?: boolean;\n\n\t/** The origin whose broadcasts are served, spanning reconnects. Implies a private loop. */\n\tpublish?: Origin.Consumer;\n\n\t/** The origin fed with the peer's announced broadcasts, spanning reconnects. Implies a private loop. */\n\tconsume?: Origin.Producer;\n\n\t/** Backoff settings for the reconnect loop; an unset field uses its default. */\n\tdelay?: ReloadDelay;\n\n\t/**\n\t * How to react to the relay's GOAWAY; an unset field uses its default. Every connection\n\t * migrates on GOAWAY, dialing the replacement while the old session finishes its groups.\n\t * This only tunes where it may go and for how long the old session serves.\n\t */\n\tgoaway?: GoawayProps;\n\n\t/** A Connection 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; call {@link Connection.connect} instead. */\n\ttransport?: never;\n}\n\n/**\n * A cloneable handle on a MoQ connection: `new Connection({ url })` reconnects and, by\n * default, shares one origin and one reconnect loop with every other handle on that URL.\n *\n * The shared {@link origin} is wired to both directions. Everything the relay announces\n * lands in it, a publish into it is announced to the relay, and a page that publishes and\n * watches the same path resolves it locally with no round trip.\n *\n * {@link close} releases this handle; the connection survives its last handle by a short\n * linger window (see {@link ConnectionProps.linger}), so a component torn down and rebuilt\n * reuses the warm connection instead of redialing.\n *\n * The loop reconnects for as long as a handle holds it, so an outage of any length recovers\n * on its own. An auth rejection stops retrying those credentials and retires the shared\n * connection so the next handle dials fresh; a new URL on this handle starts another\n * sequence. {@link closed} settles only when this handle is released.\n *\n * A relay's GOAWAY migrates rather than drops: the replacement dials at once while the old\n * session finishes its groups, and the handle and its origin carry across. A redirect the\n * {@link ConnectionProps.goaway} policy refuses stops the loop like an auth rejection does.\n *\n * Options the pool cannot honor (transport options, discovery, delay, goaway, a pinned\n * certificate, caller-owned origins) use a private loop. An explicit `share: true`\n * refuses them. A supplied transport cannot reconnect at all; pass it to {@link Connection.connect}\n * instead.\n *\n * @public\n */\nexport class Connection {\n\t/** Establish a one-shot session; a supplied transport belongs here, not in the reconnect loop. */\n\tstatic readonly connect = connect;\n\n\t/** Accept a one-shot session on an already-open transport. */\n\tstatic readonly accept = accept;\n\n\t/** SHA-256 of a certificate, for pinning via `webtransport.serverCertificateHashes`. */\n\tstatic readonly certificateHash = certificateHash;\n\n\t/** Whether this runtime can connect with WebTransport. */\n\tstatic readonly isWebTransportSupported = isWebTransportSupported;\n\n\t/** Relay URL to connect to; updating it reconnects to that URL. */\n\turl: Signal<URL | undefined>;\n\n\t/** Whether to hold a connection at all; clearing it releases this handle's share. */\n\tenabled: Signal<boolean>;\n\n\t/** Current status of the connection. */\n\treadonly status: Getter<ReloadStatus>;\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 a private retry window expires. Cleared when a new URL\n\t * or a disable/re-enable starts another sequence, not on a page hide/show.\n\t */\n\treadonly error: Getter<Error | undefined>;\n\n\t/**\n\t * The wire transport the current session runs over, or undefined while disconnected.\n\t *\n\t * The session itself is deliberately not exposed: it is shared, so no handle may close\n\t * or reconfigure it, and everything else it offers is reachable through {@link origin}.\n\t */\n\treadonly transport: Getter<TransportType | undefined>;\n\n\t/** The current connection's PROBE estimates, or undefined while disconnected. */\n\treadonly probe: Getter<ProbeType | undefined>;\n\n\t/**\n\t * The send-side bandwidth allocator for the current URL, or undefined\n\t * while disabled or URL-less.\n\t *\n\t * Every handle on this URL shares the same instance, so publishers reserve\n\t * against one registry. Borrowed, not owned: the type has no close, since\n\t * closing it would starve every other handle.\n\t */\n\treadonly bandwidth: Getter<Handle | undefined>;\n\n\t/**\n\t * The origin for the current URL, or undefined while disabled or URL-less.\n\t *\n\t * Publish into it or consume from it; a shared handle's origin is the same one every\n\t * other handle on this URL uses, and it spans the connection's reconnects. Borrowed,\n\t * not owned: the type has no close, since closing it would tear the origin down under\n\t * every other handle.\n\t */\n\treadonly origin: Getter<Origin.Table | undefined>;\n\n\t/**\n\t * Settles once this handle is released via {@link close}: `null` on a clean close, or\n\t * the abort {@link Error}. Peek it synchronously (`undefined` while open), observe it\n\t * reactively, or `await` it. Attempt failures live on {@link 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\treadonly #status = new Signal<ReloadStatus>(\"disconnected\");\n\treadonly #established = new Signal<EstablishedType | undefined>(undefined);\n\treadonly #probe = new Signal<ProbeType | undefined>(undefined);\n\treadonly #origin = new Signal<Origin.Producer | undefined>(undefined);\n\treadonly #bandwidth = new Signal<Handle | undefined>(undefined);\n\treadonly #error = new Signal<Error | undefined>(undefined);\n\t#signals: Effect;\n\n\t/**\n\t * Take a handle on the connection for {@link ConnectionProps.url}.\n\t *\n\t * Dials immediately when a URL is given and `enabled` is not false; otherwise waits for\n\t * the signals to say go. The handle owns nothing but its own share: {@link close}\n\t * releases it, and the underlying connection and origin live for as long as any handle\n\t * (plus the linger window) wants them.\n\t */\n\tconstructor(props?: ConnectionProps) {\n\t\trefuse(props);\n\t\tthis.#signals = new Effect();\n\n\t\tthis.url = Signal.from(props?.url);\n\t\tthis.enabled = Signal.from(props?.enabled ?? true);\n\t\tthis.status = this.#status;\n\t\tthis.error = this.#error;\n\t\tthis.probe = this.#probe;\n\t\tthis.origin = this.#origin;\n\t\tthis.bandwidth = this.#bandwidth;\n\t\tthis.transport = this.#signals.computed((effect) => effect.get(this.#established)?.transport);\n\n\t\tconst linger = props?.linger;\n\n\t\t// Key on the serialized URL: URL objects use identity equality, and an equivalent\n\t\t// instance must not release and redial.\n\t\tconst href = this.#signals.computed((effect) => effect.get(this.url)?.href);\n\n\t\tif (props && (props.share === false || requiresPrivate(props))) {\n\t\t\tthis.#runPrivate(props, href);\n\t\t\treturn;\n\t\t}\n\n\t\tthis.#signals.run((effect) => {\n\t\t\tif (!effect.get(this.enabled)) return;\n\t\t\tconst key = effect.get(href);\n\t\t\tif (!key) return;\n\n\t\t\tconst lease = acquire(key, linger);\n\t\t\teffect.cleanup(lease.release);\n\n\t\t\teffect.set(this.#origin, lease.origin, undefined);\n\t\t\teffect.set(this.#bandwidth, lease.connection.bandwidth, undefined);\n\n\t\t\t// Proxy the shared loop's outputs, so this handle reads like its own connection.\n\t\t\teffect.run((nested) => nested.set(this.#status, nested.get(lease.connection.status), \"disconnected\"));\n\t\t\teffect.run((nested) => nested.set(this.#established, nested.get(lease.connection.established), undefined));\n\t\t\teffect.run((nested) => nested.set(this.#probe, nested.get(lease.connection.probe), undefined));\n\t\t\teffect.run((nested) => nested.set(this.#error, nested.get(lease.connection.error), undefined));\n\t\t});\n\t}\n\n\t#runPrivate(props: ConnectionProps, href: Getter<string | undefined>): void {\n\t\tconst owned = props.consume === undefined;\n\t\tconst origin = props.consume ?? new Origin.Producer();\n\t\tif (owned) this.#signals.cleanup(() => origin.close());\n\n\t\tconst loop = new Reload({\n\t\t\turl: this.url,\n\t\t\tenabled: this.enabled,\n\t\t\tpublish: props.publish ?? (owned ? origin.consume() : undefined),\n\t\t\tconsume: origin,\n\t\t\twebtransport: props.webtransport,\n\t\t\twebsocket: props.websocket,\n\t\t\tdiscovery: props.discovery,\n\t\t\t// A handle nobody watches wants unlimited retries; an auth rejection still\n\t\t\t// stops this URL, and a new one starts another sequence.\n\t\t\tdelay: { timeout: Time.Milli(0), ...props.delay },\n\t\t\tgoaway: props.goaway,\n\t\t});\n\t\tthis.#signals.cleanup(() => loop.close());\n\n\t\tthis.#signals.run((effect) => {\n\t\t\tif (!effect.get(this.enabled) || !effect.get(href)) return;\n\t\t\teffect.set(this.#origin, origin, undefined);\n\t\t\teffect.set(this.#bandwidth, loop.bandwidth, undefined);\n\t\t});\n\t\tthis.#signals.run((effect) => effect.set(this.#status, effect.get(loop.status), \"disconnected\"));\n\t\tthis.#signals.run((effect) => effect.set(this.#established, effect.get(loop.established), undefined));\n\t\tthis.#signals.run((effect) => effect.set(this.#probe, effect.get(loop.probe), undefined));\n\t\tthis.#signals.run((effect) => effect.set(this.#error, effect.get(loop.error), undefined));\n\t}\n\n\t/**\n\t * Subscribe to broadcast announcements matching `scope`, spanning reconnects\n\t * and URL switches: a switch retracts everything from\n\t * the old relay's origin, then the new one's arrivals stream in.\n\t */\n\tannounced(scope: Path.Pattern = Path.Pattern.all(), options?: Announce.Options): Announce.Consumer {\n\t\tconst producer = new Announce.Producer();\n\t\tconst consumer = producer.consume();\n\n\t\t// Closing the consumer closes the shared state, so stop appending after that.\n\t\tlet closed = false;\n\t\tvoid consumer.closed.then(() => {\n\t\t\tclosed = true;\n\t\t});\n\n\t\t// A child of this handle's scope rather than a standalone Effect it merely cleans up\n\t\t// after: the disposer run() hands back also drops itself from the parent, so opening\n\t\t// and closing announcement streams repeatedly does not pile up dead pumps that live\n\t\t// until the whole handle closes.\n\t\tconst stop = this.#signals.run((effect) => {\n\t\t\tconst origin = effect.get(this.#origin);\n\t\t\tif (!origin) return;\n\n\t\t\tconst upstream = origin.announced(scope, options);\n\t\t\teffect.cleanup(() => upstream.close());\n\n\t\t\t// Track what this origin announced so a URL switch retracts it; the last\n\t\t\t// 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} finally {\n\t\t\t\t\tif (!closed) {\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\tvoid consumer.closed.then(stop);\n\n\t\treturn consumer;\n\t}\n\n\t/** Snapshot the live connection's transport counters, or undefined while disconnected. */\n\tasync stats(): Promise<StatsType | undefined> {\n\t\treturn this.#established.peek()?.stats();\n\t}\n\n\t/**\n\t * Release this handle. The shared connection closes once its last handle is gone and\n\t * the linger window passes; other handles on the URL are unaffected. Idempotent.\n\t */\n\tclose(abort?: Error): void {\n\t\tthis.#signals.close();\n\t\tif (this.#closed.peek() === undefined) this.#closed.set(abort ?? null);\n\t}\n}\n\n/** Types on {@link Connection}: the handle is the class, these are its associated types. */\nexport namespace Connection {\n\t/** Options for {@link Connection}. */\n\texport type Props = ConnectionProps;\n\t/** Options for {@link Connection.connect}. */\n\texport type ConnectProps = ConnectPropsType;\n\t/** Options for {@link Connection.accept}. */\n\texport type AcceptProps = AcceptPropsType;\n\t/** Backoff settings for a private reconnect loop. */\n\texport type Backoff = ReloadDelay;\n\t/** How a connection reacts to the relay's GOAWAY. */\n\texport type Goaway = GoawayProps;\n\t/** What to do with the URI a relay names in its GOAWAY. */\n\texport type Redirect = RedirectType;\n\t/** Current state of a {@link Connection}. */\n\texport type Status = ReloadStatus;\n\t/** The current connection's PROBE estimates. */\n\texport type Probe = ProbeType;\n\t/** A point-in-time snapshot of the transport's counters. */\n\texport type Stats = StatsType;\n\t/** The wire transport a session runs over. */\n\texport type Transport = TransportType;\n\t/** Tuning for the WebSocket fallback. */\n\texport type WebSocketProps = WebSocketPropsType;\n\t/** WebTransport options, including friendlier certificate pinning. */\n\texport type WebTransportProps = WebTransportPropsType;\n\t/** A server certificate hash used to pin a self-signed server. */\n\texport type CertificateHash = CertificateHashType;\n\t/** An established one-shot session. */\n\texport type Established = EstablishedType;\n}\n\n/** Throw if `props` cannot be honored, rather than silently dropping them. */\nfunction refuse(props?: ConnectionProps): void {\n\tif (!props) return;\n\n\tconst extra = props as ConnectionProps & { transport?: unknown; signal?: unknown };\n\tif (extra.transport) {\n\t\tthrow new Error(\"a supplied transport cannot reconnect; call Connection.connect() instead\");\n\t}\n\tif (extra.signal) {\n\t\tthrow new Error(\"a Connection owns its abort signal; do not pass one\");\n\t}\n\tif (props.share !== true || !requiresPrivate(props)) return;\n\n\tif (props.publish || props.consume) {\n\t\tthrow new Error(\"caller-owned origins cannot be shared; pass share: false\");\n\t}\n\tconst hashes = props.webtransport?.serverCertificateHashes?.length ?? 0;\n\tif (props.webtransport?.serverCertificate !== undefined || hashes > 0) {\n\t\tthrow new Error(\"a pinned certificate cannot be shared; pass share: false\");\n\t}\n\tif (props.webtransport !== undefined) {\n\t\tthrow new Error(\"webtransport options cannot be shared; pass share: false\");\n\t}\n\tif (props.websocket !== undefined) {\n\t\tthrow new Error(\"websocket options cannot be shared; pass share: false\");\n\t}\n\tif (props.discovery !== undefined) {\n\t\tthrow new Error(\"discovery cannot be shared; pass share: false\");\n\t}\n\tif (props.delay !== undefined) {\n\t\tthrow new Error(\"delay cannot be shared; pass share: false\");\n\t}\n\tif (props.goaway !== undefined) {\n\t\tthrow new Error(\"goaway cannot be shared; pass share: false\");\n\t}\n}\n\n/** Options tied to one handle cannot be represented by a URL-keyed shared entry. */\nfunction requiresPrivate(props: ConnectionProps): boolean {\n\treturn (\n\t\tprops.webtransport !== undefined ||\n\t\tprops.websocket !== undefined ||\n\t\tprops.discovery !== undefined ||\n\t\tprops.delay !== undefined ||\n\t\tprops.goaway !== undefined ||\n\t\tprops.publish !== undefined ||\n\t\tprops.consume !== undefined\n\t);\n}\n\n/** One shared connection and the handles keeping it alive. */\ninterface Entry {\n\t/** The pool key: the dialed URL, which a GOAWAY redirect moves. */\n\tkey: string;\n\torigin: Origin.Producer;\n\tconnection: Reload;\n\trefs: number;\n\tlinger: Time.Milli;\n\ttimer?: ReturnType<typeof setTimeout>;\n}\n\n/** The process-wide pool backing {@link Connection}. */\nconst pool = new Map<string, Entry>();\n\n/** Take a reference on the shared entry for `key`, creating it on first use. */\nfunction acquire(key: string, linger?: Time.Milli): Entry & { release: () => void } {\n\tlet entry = pool.get(key);\n\tif (!entry) {\n\t\tconst origin = new Origin.Producer();\n\t\tconst connection = new Reload({\n\t\t\turl: new URL(key),\n\t\t\tenabled: true,\n\t\t\tpublish: origin.consume(),\n\t\t\tconsume: origin,\n\t\t\t// Nobody observes a shared loop's `closed`, so giving up would strand every handle\n\t\t\t// on this URL offline until the page reloads. Retry for as long as the entry lives\n\t\t\t// instead; an auth rejection still stops this URL, and evicts below.\n\t\t\tdelay: { timeout: Time.Milli(0) },\n\t\t});\n\n\t\tconst created: Entry = { key, origin, connection, refs: 0, linger: linger ?? LINGER_MS };\n\n\t\t// The loop only stops on a peer saying these credentials will never work, or on a\n\t\t// GOAWAY redirect it refused. Drop the entry so a later handle dials fresh rather\n\t\t// than joining a loop that has stopped; handles already on it keep it until they\n\t\t// release.\n\t\tconnection.error.subscribe((err) => {\n\t\t\tif (err !== undefined && pool.get(created.key) === created) pool.delete(created.key);\n\t\t});\n\n\t\t// An accepted redirect moves the entry to the URL it now dials, so a later handle\n\t\t// configured with that URL shares it, and one asking for the old URL dials fresh.\n\t\t// A live entry already at the target wins: this one leaves the pool and serves only\n\t\t// the handles it has until they release it.\n\t\tconnection.redirect.subscribe((redirect) => {\n\t\t\tif (!redirect || redirect.href === created.key) return;\n\t\t\tif (pool.get(created.key) === created) pool.delete(created.key);\n\t\t\tcreated.key = redirect.href;\n\t\t\tif (!pool.has(created.key)) pool.set(created.key, created);\n\t\t});\n\n\t\tentry = created;\n\t\tpool.set(key, created);\n\t}\n\n\tconst taken = entry;\n\ttaken.linger = Time.Milli(Math.max(taken.linger, linger ?? LINGER_MS));\n\ttaken.refs += 1;\n\tif (taken.timer !== undefined) {\n\t\tclearTimeout(taken.timer);\n\t\ttaken.timer = undefined;\n\t}\n\n\tlet released = false;\n\treturn {\n\t\t...taken,\n\t\trelease: () => {\n\t\t\tif (released) return;\n\t\t\treleased = true;\n\n\t\t\ttaken.refs -= 1;\n\t\t\tif (taken.refs > 0) return;\n\n\t\t\ttaken.timer = setTimeout(() => {\n\t\t\t\tif (pool.get(taken.key) === taken) pool.delete(taken.key);\n\t\t\t\ttaken.connection.close();\n\t\t\t\ttaken.origin.close();\n\t\t\t}, taken.linger);\n\n\t\t\t// Don't hold a Node process open for a connection nobody is using.\n\t\t\t(taken.timer as { unref?: () => void }).unref?.();\n\t\t},\n\t};\n}\n\n/**\n * Close every shared connection immediately, so the next handle dials fresh.\n *\n * Exists for tests, which otherwise share connections across cases.\n *\n * @internal\n */\nexport function resetShared(): void {\n\tconst entries = [...pool.values()];\n\tpool.clear();\n\tfor (const entry of entries) {\n\t\tif (entry.timer !== undefined) clearTimeout(entry.timer);\n\t\tentry.connection.close();\n\t\tentry.origin.close();\n\t}\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reload.d.ts","sourceRoot":"","sources":["../../src/connection/reload.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"reload.d.ts","sourceRoot":"","sources":["../../src/connection/reload.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AAOnC;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,GAAG;IACzB,uDAAuD;IACvD,OAAO,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC;IAErB,iDAAiD;IACjD,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,2CAA2C;IAC3C,GAAG,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC;IAEjB;;;;OAIG;IACH,OAAO,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC;CACrB,CAAC;AAkDF,kDAAkD;AAClD,MAAM,MAAM,YAAY,GAAG,YAAY,GAAG,WAAW,GAAG,cAAc,CAAC"}
|