@decentnetwork/peer 0.1.146 → 0.1.148

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.
@@ -54,6 +54,7 @@ export class LegacyExpressClient {
54
54
  await this.#postEncrypted(friendUserId, friendEncrypted);
55
55
  }
56
56
  async pullOnce() {
57
+ this.#debugLog(`pullOnce: ${this.#nodes.length} node(s)`);
57
58
  if (!this.#nodes.length) {
58
59
  return;
59
60
  }
@@ -77,6 +78,9 @@ export class LegacyExpressClient {
77
78
  }
78
79
  const messages = parseExpressResponseFrames(body);
79
80
  if (messages.length === 0) {
81
+ // Silent until now: a body that arrives but parses to nothing looked
82
+ // exactly like an empty inbox.
83
+ this.#debugLog(`pullOnce: ${body.length} byte(s) from ${node.host} parsed to 0 frames`);
80
84
  continue;
81
85
  }
82
86
  this.#debugLog(`pullOnce got ${messages.length} offline frame(s) from ${node.host}:${node.port}`);
package/dist/peer.js CHANGED
@@ -3739,8 +3739,14 @@ export class Peer {
3739
3739
  }
3740
3740
  #ensureExpressPullLoop() {
3741
3741
  if (!this.#express?.hasNodes() || this.#expressPollTimer || EXPRESS_PULL_INTERVAL_MS <= 0) {
3742
+ // Three ways to silently do nothing, and no way to tell them apart from
3743
+ // outside — which cost a long evening of guessing why offline mail was
3744
+ // never collected in a browser.
3745
+ this.#debugLog(`express pull loop NOT started: hasClient=${!!this.#express} hasNodes=${!!this.#express?.hasNodes()} ` +
3746
+ `alreadyRunning=${!!this.#expressPollTimer} interval=${EXPRESS_PULL_INTERVAL_MS}`);
3742
3747
  return;
3743
3748
  }
3749
+ this.#debugLog(`express pull loop started, every ${EXPRESS_PULL_INTERVAL_MS}ms`);
3744
3750
  const pull = () => {
3745
3751
  void this.#express?.pullOnce().catch((error) => {
3746
3752
  this.#debugLog(`express pull failed: ${error.message}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decentnetwork/peer",
3
- "version": "0.1.146",
3
+ "version": "0.1.148",
4
4
  "description": "Pure TypeScript port of Elastos Carrier (toxcore-derived) P2P messaging. DHT, onion routing, TCP relay, FlatBuffers app payloads, Express offline relay. Wire-compatible with iOS Beagle and the Carrier C SDK.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",