*Handle available only having 1 item

This commit is contained in:
Derrick Hammer 2022-07-26 23:59:45 -04:00
parent 7a12d7e4cd
commit 1090b203dc
1 changed files with 5 additions and 1 deletions

View File

@ -141,7 +141,11 @@ export default class DHT {
break; break;
} }
const relayIndex = await randomNumber(0, available.length - 1); let relayIndex = 0;
if (available.length > 1) {
relayIndex = await randomNumber(0, available.length - 1);
}
const connection = this._relays.get(available[relayIndex]) as string; const connection = this._relays.get(available[relayIndex]) as string;