*Abort if no available relays to process
This commit is contained in:
parent
a0ecea1dc9
commit
35eed2a157
|
@ -118,6 +118,9 @@ export default class DHT {
|
|||
private async fillConnections(): Promise<any> {
|
||||
let available = [...this._relays.keys()].filter(x => [...this._activeRelays.keys()].includes(x));
|
||||
let relayPromises = [];
|
||||
if (0 > available.length) {
|
||||
return;
|
||||
}
|
||||
while (this._activeRelays.size <= Math.min(this._maxConnections, available.length + this._activeRelays.size)) {
|
||||
const relayIndex = await randomNumber(0, available.length - 1);
|
||||
|
||||
|
|
Loading…
Reference in New Issue