@leofcoin/peernet 1.1.90 → 1.1.92
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.
- package/exports/browser/{client-D9SOK3zV.js → client-Vbt0C3YZ.js} +1 -1
- package/exports/browser/{messages-CWqbyda0.js → messages-BYZZUpuv.js} +1 -1
- package/exports/browser/{peernet-plahMKpJ.js → peernet-DKc812jS.js} +12 -3
- package/exports/browser/peernet.js +1 -1
- package/exports/peernet.js +10 -1
- package/package.json +1 -1
- package/src/peernet.ts +10 -1
|
@@ -8261,6 +8261,7 @@ class Peernet {
|
|
|
8261
8261
|
_peerHandler;
|
|
8262
8262
|
protos;
|
|
8263
8263
|
version;
|
|
8264
|
+
#peerAttempts = {};
|
|
8264
8265
|
/**
|
|
8265
8266
|
* @access public
|
|
8266
8267
|
* @param {Object} options
|
|
@@ -8371,7 +8372,7 @@ class Peernet {
|
|
|
8371
8372
|
this.root = options.root;
|
|
8372
8373
|
const { RequestMessage, ResponseMessage, PeerMessage, PeerMessageResponse, PeernetMessage, DHTMessage, DHTMessageResponse, DataMessage, DataMessageResponse, PsMessage, ChatMessage, PeernetFile
|
|
8373
8374
|
// FolderMessageResponse
|
|
8374
|
-
} = await import(/* webpackChunkName: "messages" */ './messages-
|
|
8375
|
+
} = await import(/* webpackChunkName: "messages" */ './messages-BYZZUpuv.js');
|
|
8375
8376
|
/**
|
|
8376
8377
|
* proto Object containing protos
|
|
8377
8378
|
* @type {Object}
|
|
@@ -8465,7 +8466,7 @@ class Peernet {
|
|
|
8465
8466
|
if (this.#starting || this.#started)
|
|
8466
8467
|
return;
|
|
8467
8468
|
this.#starting = true;
|
|
8468
|
-
const importee = await import('./client-
|
|
8469
|
+
const importee = await import('./client-Vbt0C3YZ.js');
|
|
8469
8470
|
/**
|
|
8470
8471
|
* @access public
|
|
8471
8472
|
* @type {PeernetClient}
|
|
@@ -8724,7 +8725,15 @@ class Peernet {
|
|
|
8724
8725
|
debug(`Error while requesting data from ${id}`, error);
|
|
8725
8726
|
// if error, remove provider
|
|
8726
8727
|
this.dht.removeProvider(id, hash);
|
|
8727
|
-
|
|
8728
|
+
if (this.#peerAttempts[id] > 1) {
|
|
8729
|
+
this.#peerAttempts[id] = 0;
|
|
8730
|
+
debug(`Removed provider ${id} for ${hash} after 3 attempts`);
|
|
8731
|
+
console.error(nothingFoundError(hash));
|
|
8732
|
+
return undefined;
|
|
8733
|
+
}
|
|
8734
|
+
if (this.#peerAttempts[id] === undefined)
|
|
8735
|
+
this.#peerAttempts[id] = 0;
|
|
8736
|
+
this.#peerAttempts[id]++;
|
|
8728
8737
|
return this.requestData(hash, store?.name || store);
|
|
8729
8738
|
}
|
|
8730
8739
|
// this.put(hash, proto.decoded.data)
|
package/exports/peernet.js
CHANGED
|
@@ -342,6 +342,7 @@ class Peernet {
|
|
|
342
342
|
_peerHandler;
|
|
343
343
|
protos;
|
|
344
344
|
version;
|
|
345
|
+
#peerAttempts = {};
|
|
345
346
|
/**
|
|
346
347
|
* @access public
|
|
347
348
|
* @param {Object} options
|
|
@@ -805,7 +806,15 @@ class Peernet {
|
|
|
805
806
|
debug(`Error while requesting data from ${id}`, error);
|
|
806
807
|
// if error, remove provider
|
|
807
808
|
this.dht.removeProvider(id, hash);
|
|
808
|
-
|
|
809
|
+
if (this.#peerAttempts[id] > 1) {
|
|
810
|
+
this.#peerAttempts[id] = 0;
|
|
811
|
+
debug(`Removed provider ${id} for ${hash} after 3 attempts`);
|
|
812
|
+
console.error(nothingFoundError(hash));
|
|
813
|
+
return undefined;
|
|
814
|
+
}
|
|
815
|
+
if (this.#peerAttempts[id] === undefined)
|
|
816
|
+
this.#peerAttempts[id] = 0;
|
|
817
|
+
this.#peerAttempts[id]++;
|
|
809
818
|
return this.requestData(hash, store?.name || store);
|
|
810
819
|
}
|
|
811
820
|
// this.put(hash, proto.decoded.data)
|
package/package.json
CHANGED
package/src/peernet.ts
CHANGED
|
@@ -66,6 +66,7 @@ export default class Peernet {
|
|
|
66
66
|
protos: {}
|
|
67
67
|
version
|
|
68
68
|
|
|
69
|
+
#peerAttempts: { [key: string]: number } = {}
|
|
69
70
|
/**
|
|
70
71
|
* @access public
|
|
71
72
|
* @param {Object} options
|
|
@@ -583,7 +584,15 @@ export default class Peernet {
|
|
|
583
584
|
debug(`Error while requesting data from ${id}`, error)
|
|
584
585
|
// if error, remove provider
|
|
585
586
|
this.dht.removeProvider(id, hash)
|
|
586
|
-
|
|
587
|
+
if (this.#peerAttempts[id] > 1) {
|
|
588
|
+
this.#peerAttempts[id] = 0
|
|
589
|
+
debug(`Removed provider ${id} for ${hash} after 3 attempts`)
|
|
590
|
+
console.error(nothingFoundError(hash))
|
|
591
|
+
return undefined
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
if (this.#peerAttempts[id] === undefined) this.#peerAttempts[id] = 0
|
|
595
|
+
this.#peerAttempts[id]++
|
|
587
596
|
return this.requestData(hash, store?.name || store)
|
|
588
597
|
}
|
|
589
598
|
|