@hive-p2p/server 1.0.58 → 1.0.59

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/core/node.mjs +5 -2
  2. package/package.json +1 -1
package/core/node.mjs CHANGED
@@ -168,12 +168,15 @@ export class Node {
168
168
  sendMessage(remoteId, data, type, spread = 1) { this.messager.sendUnicast(remoteId, data, type, spread); }
169
169
 
170
170
  /** Send a connection request to a peer */
171
- async tryConnectToPeer(targetId = 'toto', retry = 5) {
171
+ async tryConnectToPeer(targetId = 'toto', retry = 10) {
172
172
  if (this.peerStore.connected[targetId]) return; // already connected
173
173
  do {
174
174
  const { offerHash, readyOffer } = this.peerStore.offerManager.bestReadyOffer(100, false);
175
175
  if (!offerHash || !readyOffer) await new Promise(r => setTimeout(r, 1000)); // build in progress...
176
- else this.messager.sendUnicast(targetId, { signal: readyOffer.signal, offerHash }, 'signal_offer', 1);
176
+ else {
177
+ this.messager.sendUnicast(targetId, { signal: readyOffer.signal, offerHash }, 'signal_offer', 1);
178
+ return;
179
+ }
177
180
  } while (retry-- > 0);
178
181
  }
179
182
  destroy() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hive-p2p/server",
3
- "version": "1.0.58",
3
+ "version": "1.0.59",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },