@decentnetwork/peer 0.1.11 → 0.1.13

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.
Files changed (2) hide show
  1. package/dist/peer.js +9 -3
  2. package/package.json +1 -1
package/dist/peer.js CHANGED
@@ -1974,7 +1974,11 @@ export class Peer {
1974
1974
  this.#debugLog(`self announce step1 no response from ${c.node.host}:${c.node.port}`);
1975
1975
  continue;
1976
1976
  }
1977
- this.#debugLog(`self announce step1 response from ${c.node.host}:${c.node.port} isStored=${resp1.isStored}`);
1977
+ try {
1978
+ const fs = await import("fs");
1979
+ fs.appendFileSync("/tmp/decent-announce.log", `${new Date().toISOString()} step1 from=${c.node.host}:${c.node.port} isStored=${resp1.isStored}\n`);
1980
+ }
1981
+ catch { /* best-effort */ }
1978
1982
  step1Hits.push({ c, resp1 });
1979
1983
  }
1980
1984
  const step2Settled = await Promise.allSettled(step1Hits.map(({ c, resp1 }) => this.#sendAnnounceAndWait({
@@ -1994,9 +1998,11 @@ export class Peer {
1994
1998
  const r2 = step2Settled[j];
1995
1999
  const resp2 = r2.status === "fulfilled" ? r2.value : undefined;
1996
2000
  const final = resp2 ?? resp1;
1997
- if (resp2) {
1998
- this.#debugLog(`self announce step2 response from ${c.node.host}:${c.node.port} isStored=${resp2.isStored}`);
2001
+ try {
2002
+ const fs = await import("fs");
2003
+ fs.appendFileSync("/tmp/decent-announce.log", `${new Date().toISOString()} step2 from=${c.node.host}:${c.node.port} ${resp2 ? "isStored=" + resp2.isStored : "NO_RESPONSE"}\n`);
1999
2004
  }
2005
+ catch { /* best-effort */ }
2000
2006
  if (final.isStored === 2) {
2001
2007
  storedNodes.push(c.node);
2002
2008
  // Keep dhtHealth.selfAnnounceStoredOn live within the loop,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decentnetwork/peer",
3
- "version": "0.1.11",
3
+ "version": "0.1.13",
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",