*Store copy of activeRelay size to prevent infinite loop
This commit is contained in:
parent
8ee4df8d1b
commit
7cb32b716a
|
@ -130,9 +130,12 @@ export default class DHT {
|
|||
if (0 === available.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
const activeRelays = this._activeRelays.size;
|
||||
|
||||
while (
|
||||
this._activeRelays.size <=
|
||||
Math.min(this._maxConnections, available.length + this._activeRelays.size)
|
||||
Math.min(this._maxConnections, available.length + activeRelays)
|
||||
) {
|
||||
const relayIndex = await randomNumber(0, available.length - 1);
|
||||
|
||||
|
|
Loading…
Reference in New Issue