wire-mesh-core 2.0.0 → 2.0.1

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.
@@ -15,6 +15,9 @@ function createRelayPairings() {
15
15
  add: (device) => {
16
16
  established.set(require_domain_device_id.deviceIdToHex(device), device);
17
17
  },
18
+ remove: (device) => {
19
+ established.delete(require_domain_device_id.deviceIdToHex(device));
20
+ },
18
21
  list: () => [...established.values()]
19
22
  };
20
23
  }
@@ -378,10 +381,13 @@ function createSessionCore(identity, clock, reconnect, dial, onPeerAdvert, addre
378
381
  if (timeoutMs === void 0) return outcome;
379
382
  return Promise.race([outcome, new Promise((resolve) => {
380
383
  setTimeout(() => {
381
- if (pendingManageRequests.delete(requestId)) resolve({
382
- result: "error",
383
- code: "timeout"
384
- });
384
+ if (pendingManageRequests.delete(requestId)) {
385
+ if (targetDevice !== void 0) relayPairings.remove(targetDevice);
386
+ resolve({
387
+ result: "error",
388
+ code: "timeout"
389
+ });
390
+ }
385
391
  }, timeoutMs);
386
392
  })]);
387
393
  },
@@ -14,6 +14,9 @@ function createRelayPairings() {
14
14
  add: (device) => {
15
15
  established.set(deviceIdToHex(device), device);
16
16
  },
17
+ remove: (device) => {
18
+ established.delete(deviceIdToHex(device));
19
+ },
17
20
  list: () => [...established.values()]
18
21
  };
19
22
  }
@@ -377,10 +380,13 @@ function createSessionCore(identity, clock, reconnect, dial, onPeerAdvert, addre
377
380
  if (timeoutMs === void 0) return outcome;
378
381
  return Promise.race([outcome, new Promise((resolve) => {
379
382
  setTimeout(() => {
380
- if (pendingManageRequests.delete(requestId)) resolve({
381
- result: "error",
382
- code: "timeout"
383
- });
383
+ if (pendingManageRequests.delete(requestId)) {
384
+ if (targetDevice !== void 0) relayPairings.remove(targetDevice);
385
+ resolve({
386
+ result: "error",
387
+ code: "timeout"
388
+ });
389
+ }
384
390
  }, timeoutMs);
385
391
  })]);
386
392
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wire-mesh-core",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "dependencies": {
5
5
  "cbor2": "2.3.0",
6
6
  "cddl.js": "1.0.1",