@dxos/network-manager 0.1.58-main.ffbb8a1 → 0.1.58-next.6d0af18
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/dist/lib/browser/{chunk-VP6DWC3F.mjs → chunk-3KLH55NB.mjs} +273 -125
- package/dist/lib/browser/chunk-3KLH55NB.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +5 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +9 -5
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/node/index.cjs +824 -564
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +1124 -864
- package/dist/lib/node/testing/index.cjs.map +4 -4
- package/dist/types/src/swarm/connection-limiter.d.ts +1 -1
- package/dist/types/src/swarm/connection-limiter.d.ts.map +1 -1
- package/dist/types/src/swarm/connection.d.ts +3 -1
- package/dist/types/src/swarm/connection.d.ts.map +1 -1
- package/dist/types/src/swarm/peer.d.ts +3 -3
- package/dist/types/src/swarm/peer.d.ts.map +1 -1
- package/dist/types/src/swarm/swarm-mapper.d.ts.map +1 -1
- package/dist/types/src/swarm/swarm.d.ts +2 -2
- package/dist/types/src/swarm/swarm.d.ts.map +1 -1
- package/dist/types/src/testing/test-builder.d.ts +1 -1
- package/dist/types/src/testing/test-builder.d.ts.map +1 -1
- package/dist/types/src/tests/basic-test-suite.d.ts.map +1 -1
- package/dist/types/src/tests/tcp-transport.test.d.ts +2 -0
- package/dist/types/src/tests/tcp-transport.test.d.ts.map +1 -0
- package/dist/types/src/topology/star-topology.d.ts.map +1 -1
- package/dist/types/src/transport/index.d.ts +1 -0
- package/dist/types/src/transport/index.d.ts.map +1 -1
- package/dist/types/src/transport/simplepeer-transport-proxy.d.ts.map +1 -1
- package/dist/types/src/transport/simplepeer-transport-service.d.ts.map +1 -1
- package/dist/types/src/transport/simplepeer-transport.d.ts.map +1 -1
- package/dist/types/src/transport/tcp-transport.browser.d.ts +12 -0
- package/dist/types/src/transport/tcp-transport.browser.d.ts.map +1 -0
- package/dist/types/src/transport/tcp-transport.d.ts +23 -0
- package/dist/types/src/transport/tcp-transport.d.ts.map +1 -0
- package/dist/types/src/transport/transport.d.ts +2 -1
- package/dist/types/src/transport/transport.d.ts.map +1 -1
- package/package.json +18 -18
- package/src/swarm/connection-limiter.ts +2 -2
- package/src/swarm/connection.test.ts +1 -1
- package/src/swarm/connection.ts +54 -27
- package/src/swarm/peer.ts +11 -3
- package/src/swarm/swarm-mapper.ts +4 -7
- package/src/swarm/swarm.test.ts +3 -3
- package/src/swarm/swarm.ts +3 -3
- package/src/testing/test-builder.ts +6 -2
- package/src/tests/basic-test-suite.ts +1 -1
- package/src/tests/memory-transport.test.ts +2 -2
- package/src/tests/tcp-transport.test.ts +67 -0
- package/src/tests/webrtc-transport.test.ts +1 -1
- package/src/topology/star-topology.ts +1 -4
- package/src/transport/index.ts +1 -0
- package/src/transport/simplepeer-transport-proxy.ts +48 -21
- package/src/transport/simplepeer-transport-service.ts +9 -5
- package/src/transport/simplepeer-transport.ts +43 -4
- package/src/transport/tcp-transport.browser.ts +28 -0
- package/src/transport/tcp-transport.ts +107 -0
- package/src/transport/transport.ts +1 -0
- package/dist/lib/browser/chunk-VP6DWC3F.mjs.map +0 -7
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DeferredTask } from '@dxos/async';
|
|
2
2
|
import { PublicKey } from '@dxos/keys';
|
|
3
|
-
export declare const MAX_CONCURRENT_INITIATING_CONNECTIONS =
|
|
3
|
+
export declare const MAX_CONCURRENT_INITIATING_CONNECTIONS = 50;
|
|
4
4
|
export type ConnectionLimiterOptions = {
|
|
5
5
|
maxConcurrentInitConnections?: number;
|
|
6
6
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection-limiter.d.ts","sourceRoot":"","sources":["../../../../src/swarm/connection-limiter.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"connection-limiter.d.ts","sourceRoot":"","sources":["../../../../src/swarm/connection-limiter.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG3C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAKvC,eAAO,MAAM,qCAAqC,KAAK,CAAC;AAExD,MAAM,MAAM,wBAAwB,GAAG;IACrC,4BAA4B,CAAC,EAAE,MAAM,CAAC;CACvC,CAAC;AAEF;;GAEG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAiB;IACtC,OAAO,CAAC,QAAQ,CAAC,6BAA6B,CAAC;IAC/C;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAE/B;IAEF,sBAAsB,eAMnB;gBAES,EAAE,4BAAoE,EAAE,GAAE,wBAA6B;IAInH;;OAEG;IACG,UAAU,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAarD;;OAEG;IACH,cAAc,CAAC,SAAS,EAAE,SAAS;CASpC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../../../../src/swarm/connection.ts"],"names":[],"mappings":"AAIA,OAAO,EAAgB,KAAK,EAAuB,MAAM,aAAa,CAAC;AAEvE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../../../../src/swarm/connection.ts"],"names":[],"mappings":"AAIA,OAAO,EAAgB,KAAK,EAAuB,MAAM,aAAa,CAAC;AAEvE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAYvC,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,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AEH,OAAO,CAAC,gBAAgB,CAA6B;gBAGnC,KAAK,EAAE,SAAS,EAChB,KAAK,EAAE,SAAS,EAAE,wBAAwB;IAC1C,QAAQ,EAAE,SAAS,EACnB,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,OAAO,EACjB,gBAAgB,EAAE,eAAe,EACjC,SAAS,EAAE,YAAY,EACvB,iBAAiB,EAAE,gBAAgB,EACnC,UAAU,CAAC,iCAAqB;IAWnD,IAAI,KAAK,oBAER;IAED,IAAI,SAAS,0BAEZ;IAED,IAAI,QAAQ,iBAEX;IAED;;OAEG;IACG,cAAc;IA6Ed,KAAK,CAAC,GAAG,CAAC,EAAE,KAAK;IAsCjB,KAAK,CAAC,GAAG,CAAC,EAAE,KAAK;IAuCvB,OAAO,CAAC,WAAW;YAKL,kBAAkB;IAgChC;;OAEG;IACG,MAAM,CAAC,GAAG,EAAE,aAAa;IA2B/B,QAAQ;IAIR,OAAO,CAAC,YAAY;CAMrB"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Event } from '@dxos/async';
|
|
2
|
-
import { SystemError } from '@dxos/errors';
|
|
3
2
|
import { PublicKey } from '@dxos/keys';
|
|
3
|
+
import { SystemError } from '@dxos/protocols';
|
|
4
4
|
import { Answer } from '@dxos/protocols/proto/dxos/mesh/swarm';
|
|
5
|
+
import { Connection } from './connection';
|
|
6
|
+
import { ConnectionLimiter } from './connection-limiter';
|
|
5
7
|
import { OfferMessage, SignalMessage, SignalMessenger } from '../signal';
|
|
6
8
|
import { TransportFactory } from '../transport';
|
|
7
9
|
import { WireProtocolProvider } from '../wire-protocol';
|
|
8
|
-
import { Connection } from './connection';
|
|
9
|
-
import { ConnectionLimiter } from './connection-limiter';
|
|
10
10
|
export declare class ConnectionDisplacedError extends SystemError {
|
|
11
11
|
constructor();
|
|
12
12
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"peer.d.ts","sourceRoot":"","sources":["../../../../src/swarm/peer.ts"],"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AAK,EAAE,MAAM,SAAS,CAAC;AAEhC;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,eAAe,GAAG,sBAAsB,GAAG,IAAI,CAAC;AAExE;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,SAAS,CAAC;IACd,KAAK,EAAE,SAAS,CAAC;IACjB,WAAW,EAAE,SAAS,EAAE,CAAC;CAC1B;AAID,qBAAa,WAAW;
|
|
1
|
+
{"version":3,"file":"swarm-mapper.d.ts","sourceRoot":"","sources":["../../../../src/swarm/swarm-mapper.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAsB,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAIvC,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,eAAe,GAAG,sBAAsB,GAAG,IAAI,CAAC;AAExE;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,SAAS,CAAC;IACd,KAAK,EAAE,SAAS,CAAC;IACjB,WAAW,EAAE,SAAS,EAAE,CAAC;CAC1B;AAID,qBAAa,WAAW;IAWV,OAAO,CAAC,QAAQ,CAAC,MAAM;IAVnC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAA4B;IAC3D,OAAO,CAAC,QAAQ,CAAC,wBAAwB,CAA0D;IACnG,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAuD;IAE9E,QAAQ,CAAC,UAAU,oBAA2B;IAE9C,IAAI,KAAK,IAAI,QAAQ,EAAE,CAEtB;gBAE4B,MAAM,EAAE,KAAK;IA+B1C,OAAO,CAAC,OAAO;IAmDf,OAAO;CAIR"}
|
|
@@ -3,13 +3,13 @@ import { PublicKey } from '@dxos/keys';
|
|
|
3
3
|
import { Messenger } from '@dxos/messaging';
|
|
4
4
|
import { SwarmEvent } from '@dxos/protocols/proto/dxos/mesh/signal';
|
|
5
5
|
import { Answer } from '@dxos/protocols/proto/dxos/mesh/swarm';
|
|
6
|
+
import { Connection } from './connection';
|
|
7
|
+
import { ConnectionLimiter } from './connection-limiter';
|
|
6
8
|
import { OfferMessage, SignalMessage } from '../signal';
|
|
7
9
|
import { Topology } from '../topology';
|
|
8
10
|
import { TransportFactory } from '../transport';
|
|
9
11
|
import { Topic } from '../types';
|
|
10
12
|
import { WireProtocolProvider } from '../wire-protocol';
|
|
11
|
-
import { Connection } from './connection';
|
|
12
|
-
import { ConnectionLimiter } from './connection-limiter';
|
|
13
13
|
/**
|
|
14
14
|
* A single peer's view of the swarm.
|
|
15
15
|
* Manages a set of connections implemented by simple-peer instances.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"swarm.d.ts","sourceRoot":"","sources":["../../../../src/swarm/swarm.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EAAmB,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE7D,OAAO,EAAE,UAAU,EAAE,MAAM,wCAAwC,CAAC;AACpE,OAAO,EAAE,MAAM,EAAE,MAAM,uCAAuC,CAAC;AAG/D,OAAO,
|
|
1
|
+
{"version":3,"file":"swarm.d.ts","sourceRoot":"","sources":["../../../../src/swarm/swarm.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EAAmB,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE7D,OAAO,EAAE,UAAU,EAAE,MAAM,wCAAwC,CAAC;AACpE,OAAO,EAAE,MAAM,EAAE,MAAM,uCAAuC,CAAC;AAG/D,OAAO,EAAE,UAAU,EAAmB,MAAM,cAAc,CAAC;A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,SAAS,CAE9B;IAED,IACI,KAAK,IAAI,KAAK,CAEjB;IAEK,IAAI;IAaJ,OAAO;IAWP,WAAW,CAAC,QAAQ,EAAE,QAAQ;IAiBpC,YAAY,CAAC,UAAU,EAAE,UAAU;IA8B7B,OAAO,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC;IAwB/C,QAAQ,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAmB/C,SAAS;IAOT,QAAQ;IAId,OAAO,CAAC,gBAAgB;YAkDV,YAAY;IAM1B,OAAO,CAAC,mBAAmB;IAuC3B;;OAEG;YACW,mBAAmB;YA0BnB,gBAAgB;CAQ/B"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { PublicKey } from '@dxos/keys';
|
|
2
2
|
import { MemorySignalManager, WebsocketSignalManager } from '@dxos/messaging';
|
|
3
3
|
import { Runtime } from '@dxos/protocols/proto/dxos/config';
|
|
4
|
+
import { TestWireProtocol, type TestTeleportExtensionFactory } from './test-wire-protocol';
|
|
4
5
|
import { NetworkManager } from '../network-manager';
|
|
5
6
|
import { FullyConnectedTopology } from '../topology';
|
|
6
7
|
import { TransportKind } from '../transport';
|
|
7
|
-
import { TestWireProtocol, type TestTeleportExtensionFactory } from './test-wire-protocol';
|
|
8
8
|
export declare const TEST_SIGNAL_HOSTS: Runtime.Services.Signal[];
|
|
9
9
|
export type TestBuilderOptions = {
|
|
10
10
|
signalHosts?: Runtime.Services.Signal[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-builder.d.ts","sourceRoot":"","sources":["../../../../src/testing/test-builder.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EACL,mBAAmB,EAGnB,sBAAsB,EACvB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,OAAO,EAAE,MAAM,mCAAmC,CAAC;AAI5D,OAAO,EAAE,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BAAe;IAc3C,oBAAoB,CAAC,SAAS,EAAE,aAAa;IAgEvC,IAAI;IAMJ,KAAK;IASX,QAAQ,CAAC,KAAK,EAAE,SAAS,GAAG,mBAAmB;IAS/C,WAAW,CAAC,KAAK,EAAE,SAAS,EAAE,gBAAgB,GAAE,4BAAuC,GAAG,mBAAmB;IAWvG,SAAS;IAIT,QAAQ;CAGf;AAGD,qBAAa,mBAAmB;IAI5B,QAAQ,CAAC,IAAI,EAAE,QAAQ;IACvB,QAAQ,CAAC,KAAK,EAAE,SAAS;IACzB,QAAQ,CAAC,gBAAgB,EAAE,4BAA4B;IALzD,QAAQ,EAAE,gBAAgB,CAAC;gBAGhB,IAAI,EAAE,QAAQ,EACd,KAAK,EAAE,SAAS,EAChB,gBAAgB,EAAE,4BAA4B;IASnD,IAAI,CAAC,QAAQ,yBAA+B;IAW5C,KAAK;CAIZ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"basic-test-suite.d.ts","sourceRoot":"","sources":["../../../../src/tests/basic-test-suite.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"basic-test-suite.d.ts","sourceRoot":"","sources":["../../../../src/tests/basic-test-suite.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAKzC;;GAEG;AACH,eAAO,MAAM,cAAc,gBAAiB,WAAW,6BA2LtD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tcp-transport.test.d.ts","sourceRoot":"","sources":["../../../../src/tests/tcp-transport.test.ts"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"star-topology.d.ts","sourceRoot":"","sources":["../../../../src/topology/star-topology.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAGvC,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEvD,qBAAa,YAAa,YAAW,QAAQ;
|
|
1
|
+
{"version":3,"file":"star-topology.d.ts","sourceRoot":"","sources":["../../../../src/topology/star-topology.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAGvC,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEvD,qBAAa,YAAa,YAAW,QAAQ;IAG/B,OAAO,CAAC,QAAQ,CAAC,YAAY;IAFzC,OAAO,CAAC,WAAW,CAAC,CAAkB;gBAET,YAAY,EAAE,SAAS;IAEpD,QAAQ;IAIR,IAAI,CAAC,UAAU,EAAE,eAAe,GAAG,IAAI;IAKvC,MAAM,IAAI,IAAI;IAwBR,OAAO,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC;IAW1C,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAG/B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/transport/index.ts"],"names":[],"mappings":"AAIA,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAC5B,cAAc,wBAAwB,CAAC;AACvC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,eAAe,CAAC;AAC9B,cAAc,4BAA4B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/transport/index.ts"],"names":[],"mappings":"AAIA,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAC5B,cAAc,wBAAwB,CAAC;AACvC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,eAAe,CAAC;AAC9B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iBAAiB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simplepeer-transport-proxy.d.ts","sourceRoot":"","sources":["../../../../src/transport/simplepeer-transport-proxy.ts"],"names":[],"mappings":";AAMA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAGpC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"simplepeer-transport-proxy.d.ts","sourceRoot":"","sources":["../../../../src/transport/simplepeer-transport-proxy.ts"],"names":[],"mappings":";AAMA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAGpC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAW1C,OAAO,EAAgC,aAAa,EAAE,MAAM,wCAAwC,CAAC;AACrG,OAAO,EAAE,MAAM,EAAE,MAAM,uCAAuC,CAAC;AAG/D,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE5E,MAAM,MAAM,8BAA8B,GAAG;IAC3C,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC,eAAe,CAAC;IAC/B,aAAa,EAAE,aAAa,CAAC;IAE7B,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/C,CAAC;AAEF,qBAAa,wBAAyB,YAAW,SAAS;IAW5C,OAAO,CAAC,QAAQ,CAAC,OAAO;IAVpC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAsB;IAC/C,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAiB;IAEtC,QAAQ,CAAC,MAAM,cAAe;IAC9B,QAAQ,CAAC,SAAS,cAAe;IACjC,QAAQ,CAAC,MAAM,cAAqB;IAEpC,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,cAAc,CAAuB;gBAEhB,OAAO,EAAE,8BAA8B;YAyCtD,iBAAiB;IAiB/B,OAAO,CAAC,WAAW;YAKL,aAAa;IAI3B,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAUtB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAkB9B;;OAEG;IAEH,UAAU;CAKX;AAGD,qBAAa,+BAAgC,YAAW,gBAAgB;IACtE,OAAO,CAAC,cAAc,CAA4B;IAClD,OAAO,CAAC,YAAY,CAAuC;IAE3D;;;OAGG;IACH,gBAAgB,CAAC,aAAa,EAAE,aAAa,GAAG,SAAS,GAAG,IAAI;IAShE,eAAe,CAAC,OAAO,EAAE,gBAAgB,GAAG,SAAS;CAatD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simplepeer-transport-service.d.ts","sourceRoot":"","sources":["../../../../src/transport/simplepeer-transport-service.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAI9C,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,WAAW,EAEX,YAAY,EACb,MAAM,wCAAwC,CAAC;
|
|
1
|
+
{"version":3,"file":"simplepeer-transport-service.d.ts","sourceRoot":"","sources":["../../../../src/transport/simplepeer-transport-service.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAI9C,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,WAAW,EAEX,YAAY,EACb,MAAM,wCAAwC,CAAC;AAYhD,qBAAa,0BAA2B,YAAW,aAAa;IAGlD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC;IAF3C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA6D;gBAE3D,aAAa,CAAC,KAAK;IAEhD,IAAI,CAAC,OAAO,EAAE,iBAAiB,GAAG,MAAM,CAAC,WAAW,CAAC;IA2E/C,UAAU,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAK7D,QAAQ,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAc1D,KAAK,CAAC,EAAE,OAAO,EAAE,EAAE,YAAY;CAQtC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simplepeer-transport.d.ts","sourceRoot":"","sources":["../../../../src/transport/simplepeer-transport.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"simplepeer-transport.d.ts","sourceRoot":"","sources":["../../../../src/transport/simplepeer-transport.ts"],"names":[],"mappings":";AAQA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,WAAW,EAAS,MAAM,aAAa,CAAC;AAIjD,OAAO,EAAE,MAAM,EAAE,MAAM,uCAAuC,CAAC;AAE/D,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAG1D,MAAM,MAAM,yBAAyB,GAAG;IACtC,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC,eAAe,CAAC;IAC/B,YAAY,CAAC,EAAE,GAAG,CAAC;IACnB,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/C,CAAC;AAEF;;GAEG;AACH,qBAAa,mBAAoB,YAAW,SAAS;IAUvC,OAAO,CAAC,QAAQ,CAAC,MAAM;IATnC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAa;IACnC,OAAO,CAAC,OAAO,CAAS;IAExB,QAAQ,CAAC,MAAM,cAAe;IAC9B,QAAQ,CAAC,SAAS,cAAe;IACjC,QAAQ,CAAC,MAAM,cAAqB;IAEpC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA8B;gBAE7B,MAAM,EAAE,yBAAyB;IAqFxD,OAAO;IASb,MAAM,CAAC,MAAM,EAAE,MAAM;YASP,kBAAkB;CAIjC;AAED,eAAO,MAAM,gCAAgC,kBAAmB,GAAG,KAAG,gBAMpE,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Event } from '@dxos/async';
|
|
2
|
+
import { ErrorStream } from '@dxos/debug';
|
|
3
|
+
import { Transport, TransportFactory } from './transport';
|
|
4
|
+
export declare const TcpTransportFactory: TransportFactory;
|
|
5
|
+
export declare class TcpTransport implements Transport {
|
|
6
|
+
readonly closed: Event<void>;
|
|
7
|
+
readonly connected: Event<void>;
|
|
8
|
+
readonly errors: ErrorStream;
|
|
9
|
+
destroy(): Promise<void>;
|
|
10
|
+
signal(): void;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=tcp-transport.browser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tcp-transport.browser.d.ts","sourceRoot":"","sources":["../../../../src/transport/tcp-transport.browser.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAI1D,eAAO,MAAM,mBAAmB,EAAE,gBAEjC,CAAC;AAEF,qBAAa,YAAa,YAAW,SAAS;IAC5C,SAAgB,MAAM,cAAqB;IAC3C,SAAgB,SAAS,cAAqB;IAC9C,SAAgB,MAAM,cAAqB;IAErC,OAAO;IAIb,MAAM;CAGP"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Event } from '@dxos/async';
|
|
2
|
+
import { ErrorStream } from '@dxos/debug';
|
|
3
|
+
import { Signal } from '@dxos/protocols/proto/dxos/mesh/swarm';
|
|
4
|
+
import { Transport, TransportFactory, TransportOptions } from './transport';
|
|
5
|
+
export declare const TcpTransportFactory: TransportFactory;
|
|
6
|
+
/**
|
|
7
|
+
* Fake transport.
|
|
8
|
+
*/
|
|
9
|
+
export declare class TcpTransport implements Transport {
|
|
10
|
+
private readonly options;
|
|
11
|
+
private _server?;
|
|
12
|
+
private _socket?;
|
|
13
|
+
readonly closed: Event<void>;
|
|
14
|
+
readonly connected: Event<void>;
|
|
15
|
+
readonly errors: ErrorStream;
|
|
16
|
+
private _destroyed;
|
|
17
|
+
private _connected;
|
|
18
|
+
constructor(options: TransportOptions);
|
|
19
|
+
destroy(): Promise<void>;
|
|
20
|
+
signal({ payload }: Signal): void;
|
|
21
|
+
private _handleSocket;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=tcp-transport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tcp-transport.d.ts","sourceRoot":"","sources":["../../../../src/transport/tcp-transport.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EAAE,MAAM,EAAE,MAAM,uCAAuC,CAAC;AAE/D,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE5E,eAAO,MAAM,mBAAmB,EAAE,gBAEjC,CAAC;AAEF;;GAEG;AACH,qBAAa,YAAa,YAAW,SAAS;IAYhC,OAAO,CAAC,QAAQ,CAAC,OAAO;IAXpC,OAAO,CAAC,OAAO,CAAC,CAAqB;IACrC,OAAO,CAAC,OAAO,CAAC,CAAqB;IAErC,SAAgB,MAAM,cAAqB;IAC3C,SAAgB,SAAS,cAAqB;IAC9C,SAAgB,MAAM,cAAqB;IAE3C,OAAO,CAAC,UAAU,CAAS;IAE3B,OAAO,CAAC,UAAU,CAAS;gBAEE,OAAO,EAAE,gBAAgB;IAsChD,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAQ9B,MAAM,CAAC,EAAE,OAAO,EAAE,EAAE,MAAM;IAW1B,OAAO,CAAC,aAAa;CAiBtB"}
|
|
@@ -6,7 +6,8 @@ export declare enum TransportKind {
|
|
|
6
6
|
SIMPLE_PEER = "SIMPLE_PEER",
|
|
7
7
|
LIBDATACHANNEL = "LIBDATACHANNEL",
|
|
8
8
|
SIMPLE_PEER_PROXY = "SIMPLE_PEER_PROXY",
|
|
9
|
-
MEMORY = "MEMORY"
|
|
9
|
+
MEMORY = "MEMORY",
|
|
10
|
+
TCP = "TCP"
|
|
10
11
|
}
|
|
11
12
|
/**
|
|
12
13
|
* Abstraction over a P2P connection transport. Currently either WebRTC or in-memory.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../../../src/transport/transport.ts"],"names":[],"mappings":";AAIA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,uCAAuC,CAAC;AAE/D,oBAAY,aAAa;IACvB,WAAW,gBAAgB;IAC3B,cAAc,mBAAmB;IACjC,iBAAiB,sBAAsB;IACvC,MAAM,WAAW;
|
|
1
|
+
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../../../src/transport/transport.ts"],"names":[],"mappings":";AAIA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,uCAAuC,CAAC;AAE/D,oBAAY,aAAa;IACvB,WAAW,gBAAgB;IAC3B,cAAc,mBAAmB;IACjC,iBAAiB,sBAAsB;IACvC,MAAM,WAAW;IACjB,GAAG,QAAQ;CACZ;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,KAAK,CAAC;IACd,SAAS,EAAE,KAAK,CAAC;IACjB,MAAM,EAAE,WAAW,CAAC;IAEpB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACzB,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;OAEG;IACH,SAAS,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC,eAAe,CAAC;IAE/B;;OAEG;IACH,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAE9C,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,eAAe,CAAC,OAAO,EAAE,gBAAgB,GAAG,SAAS,CAAC;CACvD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/network-manager",
|
|
3
|
-
"version": "0.1.58-
|
|
3
|
+
"version": "0.1.58-next.6d0af18",
|
|
4
4
|
"description": "Network Manager",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
"author": "DXOS.org",
|
|
9
9
|
"main": "dist/lib/node/index.cjs",
|
|
10
10
|
"browser": {
|
|
11
|
+
"./src/transport/tcp-transport.ts": "./src/transport/tcp-transport.browser.ts",
|
|
11
12
|
"./dist/lib/node/index.cjs": "./dist/lib/browser/index.mjs",
|
|
12
13
|
"./dist/lib/node/testing/index.cjs": "./dist/lib/browser/testing/index.mjs",
|
|
13
14
|
"./src/transport/datachannel/index.ts": "./src/transport/datachannel/index.browser.ts"
|
|
@@ -30,22 +31,21 @@
|
|
|
30
31
|
"tiny-invariant": "^1.3.1",
|
|
31
32
|
"ws": "^7.4.4",
|
|
32
33
|
"xor-distance": "^2.0.0",
|
|
33
|
-
"@dxos/async": "0.1.58-
|
|
34
|
-
"@dxos/codec-protobuf": "0.1.58-
|
|
35
|
-
"@dxos/context": "0.1.58-
|
|
36
|
-
"@dxos/credentials": "0.1.58-
|
|
37
|
-
"@dxos/crypto": "0.1.58-
|
|
38
|
-
"@dxos/debug": "0.1.58-
|
|
39
|
-
"@dxos/
|
|
40
|
-
"@dxos/
|
|
41
|
-
"@dxos/
|
|
42
|
-
"@dxos/
|
|
43
|
-
"@dxos/
|
|
44
|
-
"@dxos/
|
|
45
|
-
"@dxos/
|
|
46
|
-
"@dxos/
|
|
47
|
-
"@dxos/
|
|
48
|
-
"@dxos/util": "0.1.58-main.ffbb8a1"
|
|
34
|
+
"@dxos/async": "0.1.58-next.6d0af18",
|
|
35
|
+
"@dxos/codec-protobuf": "0.1.58-next.6d0af18",
|
|
36
|
+
"@dxos/context": "0.1.58-next.6d0af18",
|
|
37
|
+
"@dxos/credentials": "0.1.58-next.6d0af18",
|
|
38
|
+
"@dxos/crypto": "0.1.58-next.6d0af18",
|
|
39
|
+
"@dxos/debug": "0.1.58-next.6d0af18",
|
|
40
|
+
"@dxos/invariant": "0.1.58-next.6d0af18",
|
|
41
|
+
"@dxos/keys": "0.1.58-next.6d0af18",
|
|
42
|
+
"@dxos/log": "0.1.58-next.6d0af18",
|
|
43
|
+
"@dxos/messaging": "0.1.58-next.6d0af18",
|
|
44
|
+
"@dxos/node-std": "0.1.58-next.6d0af18",
|
|
45
|
+
"@dxos/protocols": "0.1.58-next.6d0af18",
|
|
46
|
+
"@dxos/rpc": "0.1.58-next.6d0af18",
|
|
47
|
+
"@dxos/teleport": "0.1.58-next.6d0af18",
|
|
48
|
+
"@dxos/util": "0.1.58-next.6d0af18"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@swc-node/register": "1.5.4",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"earljs": "~0.1.10",
|
|
56
56
|
"fast-check": "~3.3.0",
|
|
57
57
|
"typescript": "^5.2.2",
|
|
58
|
-
"@dxos/signal": "0.1.58-
|
|
58
|
+
"@dxos/signal": "0.1.58-next.6d0af18"
|
|
59
59
|
},
|
|
60
60
|
"publishConfig": {
|
|
61
61
|
"access": "public"
|
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
|
|
5
5
|
import { DeferredTask } from '@dxos/async';
|
|
6
6
|
import { Context } from '@dxos/context';
|
|
7
|
-
import { CancelledError } from '@dxos/errors';
|
|
8
7
|
import { invariant } from '@dxos/invariant';
|
|
9
8
|
import { PublicKey } from '@dxos/keys';
|
|
10
9
|
import { log } from '@dxos/log';
|
|
10
|
+
import { CancelledError } from '@dxos/protocols';
|
|
11
11
|
import { ComplexMap } from '@dxos/util';
|
|
12
12
|
|
|
13
|
-
export const MAX_CONCURRENT_INITIATING_CONNECTIONS =
|
|
13
|
+
export const MAX_CONCURRENT_INITIATING_CONNECTIONS = 50;
|
|
14
14
|
|
|
15
15
|
export type ConnectionLimiterOptions = {
|
|
16
16
|
maxConcurrentInitConnections?: number;
|
|
@@ -7,9 +7,9 @@ import { PublicKey } from '@dxos/keys';
|
|
|
7
7
|
import { log } from '@dxos/log';
|
|
8
8
|
import { describe, test } from '@dxos/test';
|
|
9
9
|
|
|
10
|
+
import { Connection } from './connection';
|
|
10
11
|
import { TestWireProtocol } from '../testing/test-wire-protocol';
|
|
11
12
|
import { createSimplePeerTransportFactory } from '../transport';
|
|
12
|
-
import { Connection } from './connection';
|
|
13
13
|
|
|
14
14
|
describe('Connection', () => {
|
|
15
15
|
test('initiator opens after responder', async () => {
|
package/src/swarm/connection.ts
CHANGED
|
@@ -5,11 +5,17 @@
|
|
|
5
5
|
import { DeferredTask, Event, sleep, synchronized } from '@dxos/async';
|
|
6
6
|
import { Context, cancelWithContext } from '@dxos/context';
|
|
7
7
|
import { ErrorStream } from '@dxos/debug';
|
|
8
|
-
import { CancelledError } from '@dxos/errors';
|
|
9
8
|
import { invariant } from '@dxos/invariant';
|
|
10
9
|
import { PublicKey } from '@dxos/keys';
|
|
11
10
|
import { log } from '@dxos/log';
|
|
12
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
CancelledError,
|
|
13
|
+
ProtocolError,
|
|
14
|
+
ConnectionResetError,
|
|
15
|
+
ConnectivityError,
|
|
16
|
+
UnknownProtocolError,
|
|
17
|
+
trace,
|
|
18
|
+
} from '@dxos/protocols';
|
|
13
19
|
import { Signal } from '@dxos/protocols/proto/dxos/mesh/swarm';
|
|
14
20
|
|
|
15
21
|
import { SignalMessage, SignalMessenger } from '../signal';
|
|
@@ -73,6 +79,9 @@ export enum ConnectionState {
|
|
|
73
79
|
* Connection closed.
|
|
74
80
|
*/
|
|
75
81
|
CLOSED = 'CLOSED',
|
|
82
|
+
|
|
83
|
+
ABORTING = 'ABORTING',
|
|
84
|
+
ABORTED = 'ABORTED',
|
|
76
85
|
}
|
|
77
86
|
|
|
78
87
|
/**
|
|
@@ -156,7 +165,7 @@ export class Connection {
|
|
|
156
165
|
// TODO(dmaretskyi): Piped streams should do this automatically, but it break's without this code.
|
|
157
166
|
this._protocol.stream.on('close', () => {
|
|
158
167
|
log('protocol stream closed');
|
|
159
|
-
this.close().catch((err) => this.errors.raise(err));
|
|
168
|
+
this.close(new ProtocolError('protocol stream closed')).catch((err) => this.errors.raise(err));
|
|
160
169
|
});
|
|
161
170
|
|
|
162
171
|
invariant(!this._transport);
|
|
@@ -179,13 +188,19 @@ export class Connection {
|
|
|
179
188
|
|
|
180
189
|
this._transport.errors.handle((err) => {
|
|
181
190
|
log('transport error:', { err });
|
|
182
|
-
// TODO(nf): collect a list of errors?
|
|
183
191
|
if (!this.closeReason) {
|
|
184
192
|
this.closeReason = err?.message;
|
|
185
193
|
}
|
|
186
|
-
|
|
187
|
-
|
|
194
|
+
|
|
195
|
+
// TODO(nf): fix ErrorStream so instanceof works here
|
|
196
|
+
if (err instanceof ConnectionResetError) {
|
|
197
|
+
log.warn('aborting due to transport ConnectionResetError');
|
|
188
198
|
this.abort().catch((err) => this.errors.raise(err));
|
|
199
|
+
} else if (err instanceof ConnectivityError) {
|
|
200
|
+
log.warn('aborting due to transport ConnectivityError');
|
|
201
|
+
this.abort().catch((err) => this.errors.raise(err));
|
|
202
|
+
} else if (err instanceof UnknownProtocolError) {
|
|
203
|
+
log.warn('unsure what to do with UnknownProtocolError, will keep on truckin', { err });
|
|
189
204
|
}
|
|
190
205
|
|
|
191
206
|
if (this._state !== ConnectionState.CLOSED && this._state !== ConnectionState.CLOSING) {
|
|
@@ -205,17 +220,18 @@ export class Connection {
|
|
|
205
220
|
|
|
206
221
|
@synchronized
|
|
207
222
|
// TODO(nf): make the caller responsible for recording the reason and determining flow control.
|
|
223
|
+
// TODO(nf): make abort cancel an existing close in progress.
|
|
208
224
|
async abort(err?: Error) {
|
|
209
225
|
log('aborting...', { err });
|
|
226
|
+
if (this._state === ConnectionState.CLOSED || this._state === ConnectionState.ABORTED) {
|
|
227
|
+
log(`abort ignored: already ${this._state}`, this.closeReason);
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
this._changeState(ConnectionState.ABORTING);
|
|
210
232
|
if (!this.closeReason) {
|
|
211
233
|
this.closeReason = err?.message;
|
|
212
234
|
}
|
|
213
|
-
if (this._state === ConnectionState.CLOSED) {
|
|
214
|
-
log('abort ignored: already closed', this.closeReason);
|
|
215
|
-
return;
|
|
216
|
-
}
|
|
217
|
-
// TODO(nf): different state?
|
|
218
|
-
this._changeState(ConnectionState.CLOSING);
|
|
219
235
|
|
|
220
236
|
await this._ctx.dispose();
|
|
221
237
|
|
|
@@ -234,8 +250,12 @@ export class Connection {
|
|
|
234
250
|
log.catch(err);
|
|
235
251
|
}
|
|
236
252
|
|
|
237
|
-
|
|
238
|
-
|
|
253
|
+
try {
|
|
254
|
+
this._callbacks?.onClosed?.(err);
|
|
255
|
+
} catch (err) {
|
|
256
|
+
log.catch(err);
|
|
257
|
+
}
|
|
258
|
+
this._changeState(ConnectionState.ABORTED);
|
|
239
259
|
}
|
|
240
260
|
|
|
241
261
|
@synchronized
|
|
@@ -243,27 +263,34 @@ export class Connection {
|
|
|
243
263
|
if (!this.closeReason) {
|
|
244
264
|
this.closeReason = err?.message;
|
|
245
265
|
}
|
|
246
|
-
if (
|
|
266
|
+
if (
|
|
267
|
+
this._state === ConnectionState.CLOSED ||
|
|
268
|
+
this._state === ConnectionState.ABORTING ||
|
|
269
|
+
this._state === ConnectionState.ABORTED
|
|
270
|
+
) {
|
|
247
271
|
return;
|
|
248
272
|
}
|
|
273
|
+
const lastState = this._state;
|
|
249
274
|
this._changeState(ConnectionState.CLOSING);
|
|
250
275
|
|
|
251
276
|
await this._ctx.dispose();
|
|
252
277
|
|
|
253
278
|
log('closing...', { peerId: this.ownId });
|
|
254
279
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
280
|
+
if (lastState === ConnectionState.CONNECTED) {
|
|
281
|
+
try {
|
|
282
|
+
// Gracefully close the stream flushing any unsent data packets.
|
|
283
|
+
await this._protocol.close();
|
|
284
|
+
} catch (err: any) {
|
|
285
|
+
log.catch(err);
|
|
286
|
+
}
|
|
261
287
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
288
|
+
try {
|
|
289
|
+
// After the transport is closed streams are disconnected.
|
|
290
|
+
await this._transport?.destroy();
|
|
291
|
+
} catch (err: any) {
|
|
292
|
+
log.catch(err);
|
|
293
|
+
}
|
|
267
294
|
}
|
|
268
295
|
|
|
269
296
|
log('closed', { peerId: this.ownId });
|
|
@@ -343,7 +370,7 @@ export class Connection {
|
|
|
343
370
|
}
|
|
344
371
|
|
|
345
372
|
private _changeState(state: ConnectionState): void {
|
|
346
|
-
log('stateChanged', { from: this._state,
|
|
373
|
+
log('stateChanged', { from: this._state, to: state, peerId: this.ownId });
|
|
347
374
|
invariant(state !== this._state, 'Already in this state.');
|
|
348
375
|
this._state = state;
|
|
349
376
|
this.stateChanged.emit(state);
|
package/src/swarm/peer.ts
CHANGED
|
@@ -4,17 +4,17 @@
|
|
|
4
4
|
|
|
5
5
|
import { Event, scheduleTask, synchronized } from '@dxos/async';
|
|
6
6
|
import { Context } from '@dxos/context';
|
|
7
|
-
import { CancelledError, SystemError } from '@dxos/errors';
|
|
8
7
|
import { invariant } from '@dxos/invariant';
|
|
9
8
|
import { PublicKey } from '@dxos/keys';
|
|
10
9
|
import { log } from '@dxos/log';
|
|
10
|
+
import { CancelledError, SystemError, TimeoutError } from '@dxos/protocols';
|
|
11
11
|
import { Answer } from '@dxos/protocols/proto/dxos/mesh/swarm';
|
|
12
12
|
|
|
13
|
+
import { Connection, ConnectionState } from './connection';
|
|
14
|
+
import { ConnectionLimiter } from './connection-limiter';
|
|
13
15
|
import { OfferMessage, SignalMessage, SignalMessenger } from '../signal';
|
|
14
16
|
import { TransportFactory } from '../transport';
|
|
15
17
|
import { WireProtocolProvider } from '../wire-protocol';
|
|
16
|
-
import { Connection, ConnectionState } from './connection';
|
|
17
|
-
import { ConnectionLimiter } from './connection-limiter';
|
|
18
18
|
|
|
19
19
|
export class ConnectionDisplacedError extends SystemError {
|
|
20
20
|
constructor() {
|
|
@@ -108,6 +108,10 @@ export class Peer {
|
|
|
108
108
|
async onOffer(message: OfferMessage): Promise<Answer> {
|
|
109
109
|
const remoteId = message.author;
|
|
110
110
|
|
|
111
|
+
if (this.connection && ![ConnectionState.CREATED, ConnectionState.INITIAL].includes(this.connection.state)) {
|
|
112
|
+
log.info(`received offer when connection already in ${this.connection.state} state`);
|
|
113
|
+
return { accept: false };
|
|
114
|
+
}
|
|
111
115
|
// Check if we are already trying to connect to that peer.
|
|
112
116
|
if (this.connection || this.initiating) {
|
|
113
117
|
// Peer with the highest Id closes its connection, and accepts remote peer's offer.
|
|
@@ -194,6 +198,10 @@ export class Peer {
|
|
|
194
198
|
this._callbacks.onAccepted();
|
|
195
199
|
} catch (err: any) {
|
|
196
200
|
log('initiation error', { err, topic: this.topic, peerId: this.localPeerId, remoteId: this.id });
|
|
201
|
+
if (err instanceof TimeoutError) {
|
|
202
|
+
log.warn('aborting connection due to signalling failure');
|
|
203
|
+
await connection.abort(err);
|
|
204
|
+
}
|
|
197
205
|
// Calls `onStateChange` with CLOSED state.
|
|
198
206
|
await this.closeConnection(err);
|
|
199
207
|
throw err;
|
|
@@ -37,10 +37,7 @@ export class SwarmMapper {
|
|
|
37
37
|
return Array.from(this._peers.values());
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
constructor(
|
|
42
|
-
private readonly _swarm: Swarm
|
|
43
|
-
) {
|
|
40
|
+
constructor(private readonly _swarm: Swarm) {
|
|
44
41
|
this._subscriptions.add(
|
|
45
42
|
_swarm.connectionAdded.on((connection) => {
|
|
46
43
|
this._update();
|
|
@@ -48,9 +45,9 @@ export class SwarmMapper {
|
|
|
48
45
|
connection.remoteId,
|
|
49
46
|
connection.stateChanged.on(() => {
|
|
50
47
|
this._update();
|
|
51
|
-
})
|
|
48
|
+
}),
|
|
52
49
|
);
|
|
53
|
-
})
|
|
50
|
+
}),
|
|
54
51
|
);
|
|
55
52
|
|
|
56
53
|
this._subscriptions.add(
|
|
@@ -58,7 +55,7 @@ export class SwarmMapper {
|
|
|
58
55
|
this._connectionSubscriptions.get(peerId)?.();
|
|
59
56
|
this._connectionSubscriptions.delete(peerId);
|
|
60
57
|
this._update();
|
|
61
|
-
})
|
|
58
|
+
}),
|
|
62
59
|
);
|
|
63
60
|
|
|
64
61
|
// if (_presence) {
|
package/src/swarm/swarm.test.ts
CHANGED
|
@@ -10,12 +10,12 @@ import { MemorySignalManager, MemorySignalManagerContext, Messenger, SignalManag
|
|
|
10
10
|
import { afterTest, describe, test } from '@dxos/test';
|
|
11
11
|
import { ComplexSet } from '@dxos/util';
|
|
12
12
|
|
|
13
|
-
import { TestWireProtocol } from '../testing/test-wire-protocol';
|
|
14
|
-
import { FullyConnectedTopology } from '../topology';
|
|
15
|
-
import { createSimplePeerTransportFactory } from '../transport';
|
|
16
13
|
import { ConnectionState } from './connection';
|
|
17
14
|
import { ConnectionLimiter } from './connection-limiter';
|
|
18
15
|
import { Swarm } from './swarm';
|
|
16
|
+
import { TestWireProtocol } from '../testing/test-wire-protocol';
|
|
17
|
+
import { FullyConnectedTopology } from '../topology';
|
|
18
|
+
import { createSimplePeerTransportFactory } from '../transport';
|
|
19
19
|
|
|
20
20
|
type TestPeer = {
|
|
21
21
|
swarm: Swarm;
|
package/src/swarm/swarm.ts
CHANGED
|
@@ -14,14 +14,14 @@ import { SwarmEvent } from '@dxos/protocols/proto/dxos/mesh/signal';
|
|
|
14
14
|
import { Answer } from '@dxos/protocols/proto/dxos/mesh/swarm';
|
|
15
15
|
import { ComplexMap, isNotNullOrUndefined } from '@dxos/util';
|
|
16
16
|
|
|
17
|
+
import { Connection, ConnectionState } from './connection';
|
|
18
|
+
import { ConnectionLimiter } from './connection-limiter';
|
|
19
|
+
import { Peer } from './peer';
|
|
17
20
|
import { SwarmMessenger, OfferMessage, SignalMessage } from '../signal';
|
|
18
21
|
import { SwarmController, Topology } from '../topology';
|
|
19
22
|
import { TransportFactory } from '../transport';
|
|
20
23
|
import { Topic } from '../types';
|
|
21
24
|
import { WireProtocolProvider } from '../wire-protocol';
|
|
22
|
-
import { Connection, ConnectionState } from './connection';
|
|
23
|
-
import { ConnectionLimiter } from './connection-limiter';
|
|
24
|
-
import { Peer } from './peer';
|
|
25
25
|
|
|
26
26
|
const INITIATION_DELAY = 100;
|
|
27
27
|
|