@decentnetwork/peer 0.1.12 → 0.1.14

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 +14 -11
  2. package/package.json +1 -1
package/dist/peer.js CHANGED
@@ -1972,14 +1972,18 @@ export class Peer {
1972
1972
  const resp1 = r.status === "fulfilled" ? r.value : undefined;
1973
1973
  if (!resp1) {
1974
1974
  this.#debugLog(`self announce step1 no response from ${c.node.host}:${c.node.port}`);
1975
+ try {
1976
+ const fs = await import("fs");
1977
+ fs.appendFileSync("/tmp/decent-announce.log", `${new Date().toISOString()} step1 from=${c.node.host}:${c.node.port} NO_RESPONSE\n`);
1978
+ }
1979
+ catch { /* best-effort */ }
1975
1980
  continue;
1976
1981
  }
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}`);
1982
+ try {
1983
+ const fs = await import("fs");
1984
+ fs.appendFileSync("/tmp/decent-announce.log", `${new Date().toISOString()} step1 from=${c.node.host}:${c.node.port} isStored=${resp1.isStored}\n`);
1985
+ }
1986
+ catch { /* best-effort */ }
1983
1987
  step1Hits.push({ c, resp1 });
1984
1988
  }
1985
1989
  const step2Settled = await Promise.allSettled(step1Hits.map(({ c, resp1 }) => this.#sendAnnounceAndWait({
@@ -1999,12 +2003,11 @@ export class Peer {
1999
2003
  const r2 = step2Settled[j];
2000
2004
  const resp2 = r2.status === "fulfilled" ? r2.value : undefined;
2001
2005
  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`);
2006
+ try {
2007
+ const fs = await import("fs");
2008
+ 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
2009
  }
2010
+ catch { /* best-effort */ }
2008
2011
  if (final.isStored === 2) {
2009
2012
  storedNodes.push(c.node);
2010
2013
  // 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.14",
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",