dsh-interconnect 0.11.17 → 0.11.19

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. */
@@ -1055,7 +1057,8 @@ var InterconnectService = class extends Service {
1055
1057
  /**
1056
1058
  * Deliver one text message to a live session on a peer instance.
1057
1059
  * @param request - the peer instance id, target session, text, and optional delivery/resume overrides.
1058
- * @returns the peer's answer, or an unreachable result when no link answers.
1060
+ * @returns the peer's answer, an unreachable result when no link answers, or a local
1061
+ * `message-too-large` result when the encoded frame would exceed the link cap.
1059
1062
  */
1060
1063
  async send(request) {
1061
1064
  const payload = {
@@ -1078,7 +1081,9 @@ var InterconnectService = class extends Service {
1078
1081
  * outbound target is the `sender` that session recorded, addressed through
1079
1082
  * this instance's own link to the sender's instance.
1080
1083
  * @param request - the LOCAL replying session id, the reply text, and optional delivery/resume overrides.
1081
- * @returns the recalled sender's answer, or an unreachable result when no link answers.
1084
+ * @returns the recalled sender's answer, an unreachable result when no link answers, or a
1085
+ * local `message-too-large` result when the encoded frame would exceed the link cap; a
1086
+ * local session that recorded no sender answers `no-sender-known` instead.
1082
1087
  */
1083
1088
  async reply(request) {
1084
1089
  const sender = this.senders.get(request.sessionId);
@@ -1217,12 +1222,12 @@ var InterconnectService = class extends Service {
1217
1222
  * dialed link plus the peer's inbound one), so one event must leave over one
1218
1223
  * of them. Which one is decided by local ownership, not by the peer: a dialed
1219
1224
  * 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.
1225
+ * skipped only when this instance has an open dialed link configured under
1226
+ * the id that socket itself announced, so a self-reported announcement can
1227
+ * never silence another peer's link; with no such dialed link every inbound
1228
+ * socket receives the event. A peer listed under a key other than the id it
1229
+ * announces is warned about once per link, because then its own inbound
1230
+ * socket is not attributable and the peer receives each event twice.
1226
1231
  *
1227
1232
  * That holds once a peer's announcement has been seen. Between this
1228
1233
  * instance's dialed link opening and the peer's `hello` arriving on its
@@ -1241,10 +1246,7 @@ var InterconnectService = class extends Service {
1241
1246
  continue;
1242
1247
  }
1243
1248
  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);
1249
+ if (dialedPeer !== void 0) covered.add(dialedPeer);
1248
1250
  }
1249
1251
  for (const socket of this.sockets) {
1250
1252
  if (this.dialedPeerOf.get(socket) === void 0) {
@@ -1577,6 +1579,13 @@ var InterconnectService = class extends Service {
1577
1579
  const frame = parsed;
1578
1580
  if (frame.type === "hello") {
1579
1581
  this.peerOf.set(socket, frame.sender);
1582
+ const dialedPeer = this.dialedPeerOf.get(socket);
1583
+ if (dialedPeer !== void 0 && dialedPeer !== frame.sender && !this.mismatchWarned.has(socket)) {
1584
+ this.mismatchWarned.add(socket);
1585
+ this.ctx.logger.warn(
1586
+ `interconnect: peer configured as ${dialedPeer} announces ${frame.sender}; list a peer under the instanceId it announces, or the duplicate inbound link is not recognised`
1587
+ );
1588
+ }
1580
1589
  return;
1581
1590
  }
1582
1591
  if (frame.type === "event") {