@decentnetwork/peer 0.1.12 → 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 -11
  2. package/package.json +1 -1
package/dist/peer.js CHANGED
@@ -1974,12 +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
- // Promoted to console.log so we can see what bootstraps respond
1978
- // without needing DECENT_DEBUG=1 set up at process launch.
1979
- // selfAnnounceStoredOn has been stuck at 0 across all peers and
1980
- // we need to see whether step1 itself fails or just step2.
1981
- // Temporary to be reverted once UDP is actually working.
1982
- console.log(`[announce-step1] 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 */ }
1983
1982
  step1Hits.push({ c, resp1 });
1984
1983
  }
1985
1984
  const step2Settled = await Promise.allSettled(step1Hits.map(({ c, resp1 }) => this.#sendAnnounceAndWait({
@@ -1999,12 +1998,11 @@ export class Peer {
1999
1998
  const r2 = step2Settled[j];
2000
1999
  const resp2 = r2.status === "fulfilled" ? r2.value : undefined;
2001
2000
  const final = resp2 ?? resp1;
2002
- if (resp2) {
2003
- console.log(`[announce-step2] from=${c.node.host}:${c.node.port} isStored=${resp2.isStored}`);
2004
- }
2005
- else {
2006
- console.log(`[announce-step2] from=${c.node.host}:${c.node.port} NO_RESPONSE`);
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`);
2007
2004
  }
2005
+ catch { /* best-effort */ }
2008
2006
  if (final.isStored === 2) {
2009
2007
  storedNodes.push(c.node);
2010
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.12",
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",