dsh-interconnect 0.11.17 → 0.11.18

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.
@@ -951,6 +951,8 @@ var InterconnectService = class extends Service {
951
951
  peerOf = /* @__PURE__ */ new WeakMap();
952
952
  /** Configured peer an outbound dial owns a socket for; absent on inbound sockets. */
953
953
  dialedPeerOf = /* @__PURE__ */ new WeakMap();
954
+ /** Dialed sockets already reported as announcing an id other than their configured key. */
955
+ mismatchWarned = /* @__PURE__ */ new WeakSet();
954
956
  /** Sender each local session last received a send from, keyed by local session id. */
955
957
  senders = /* @__PURE__ */ new Map();
956
958
  /** In-flight frames sent over a peer link, keyed by `reqId`, awaiting a correlated result. */
@@ -1217,12 +1219,12 @@ var InterconnectService = class extends Service {
1217
1219
  * dialed link plus the peer's inbound one), so one event must leave over one
1218
1220
  * of them. Which one is decided by local ownership, not by the peer: a dialed
1219
1221
  * socket is a configured peer's link and always sends. An inbound socket is
1220
- * skipped only when an open dialed link covers the id that socket itself
1221
- * announced — either because `Config.peers` lists that peer under the id, or
1222
- * because the peer announced the id over that dialed link — so an
1223
- * announcement can suppress nothing but a duplicate the controlled link
1224
- * already carries. An impostor cannot drop an event for a peer, and without a
1225
- * dialed link every inbound socket receives it.
1222
+ * skipped only when this instance has an open dialed link configured under
1223
+ * the id that socket itself announced, so a self-reported announcement can
1224
+ * never silence another peer's link; with no such dialed link every inbound
1225
+ * socket receives the event. A peer listed under a key other than the id it
1226
+ * announces is warned about once per link, because then its own inbound
1227
+ * socket is not attributable and the peer receives each event twice.
1226
1228
  *
1227
1229
  * That holds once a peer's announcement has been seen. Between this
1228
1230
  * instance's dialed link opening and the peer's `hello` arriving on its
@@ -1241,10 +1243,7 @@ var InterconnectService = class extends Service {
1241
1243
  continue;
1242
1244
  }
1243
1245
  const dialedPeer = this.dialedPeerOf.get(socket);
1244
- if (dialedPeer === void 0) continue;
1245
- covered.add(dialedPeer);
1246
- const announced = this.peerOf.get(socket);
1247
- if (announced !== void 0) covered.add(announced);
1246
+ if (dialedPeer !== void 0) covered.add(dialedPeer);
1248
1247
  }
1249
1248
  for (const socket of this.sockets) {
1250
1249
  if (this.dialedPeerOf.get(socket) === void 0) {
@@ -1577,6 +1576,13 @@ var InterconnectService = class extends Service {
1577
1576
  const frame = parsed;
1578
1577
  if (frame.type === "hello") {
1579
1578
  this.peerOf.set(socket, frame.sender);
1579
+ const dialedPeer = this.dialedPeerOf.get(socket);
1580
+ if (dialedPeer !== void 0 && dialedPeer !== frame.sender && !this.mismatchWarned.has(socket)) {
1581
+ this.mismatchWarned.add(socket);
1582
+ this.ctx.logger.warn(
1583
+ `interconnect: peer configured as ${dialedPeer} announces ${frame.sender}; list a peer under the instanceId it announces, or the duplicate inbound link is not recognised`
1584
+ );
1585
+ }
1580
1586
  return;
1581
1587
  }
1582
1588
  if (frame.type === "event") {