*Update dist
This commit is contained in:
parent
cb139131e1
commit
7a12d7e4cd
|
@ -1 +1 @@
|
||||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,uBAAuB,CAAC;AAkB5C,MAAM,CAAC,OAAO,OAAO,GAAG;IACtB,OAAO,CAAC,QAAQ,CAAM;IACtB,OAAO,CAAC,OAAO,CAAkC;IACjD,OAAO,CAAC,aAAa,CAA0C;IAC/D,OAAO,CAAC,eAAe,CAAM;IAC7B,OAAO,CAAC,OAAO,CAAS;gBAEZ,IAAI,KAAK;IAMrB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAStB,IAAI,MAAM,IAAI,MAAM,EAAE,CAErB;IAEY,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAiChD,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;IAepC,WAAW,IAAI,IAAI;YAIZ,iBAAiB;IAazB,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC;YAc/C,eAAe;CAqC9B;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,CAEvD"}
|
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,uBAAuB,CAAC;AAkB5C,MAAM,CAAC,OAAO,OAAO,GAAG;IACtB,OAAO,CAAC,QAAQ,CAAM;IACtB,OAAO,CAAC,OAAO,CAAkC;IACjD,OAAO,CAAC,aAAa,CAA0C;IAC/D,OAAO,CAAC,eAAe,CAAM;IAC7B,OAAO,CAAC,OAAO,CAAS;gBAEZ,IAAI,KAAK;IAMrB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAStB,IAAI,MAAM,IAAI,MAAM,EAAE,CAErB;IAEY,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAiChD,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;IAepC,WAAW,IAAI,IAAI;YAIZ,iBAAiB;IAazB,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC;YAc/C,eAAe;CAuC9B;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,CAEvD"}
|
|
@ -95,11 +95,11 @@ export default class DHT {
|
||||||
};
|
};
|
||||||
updateAvailable();
|
updateAvailable();
|
||||||
let relayPromises = [];
|
let relayPromises = [];
|
||||||
if (0 === available.length) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
while (this._activeRelays.size <=
|
while (this._activeRelays.size <=
|
||||||
Math.min(this._maxConnections, available.length)) {
|
Math.min(this._maxConnections, available.length)) {
|
||||||
|
if (0 === available.length) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
const relayIndex = await randomNumber(0, available.length - 1);
|
const relayIndex = await randomNumber(0, available.length - 1);
|
||||||
const connection = this._relays.get(available[relayIndex]);
|
const connection = this._relays.get(available[relayIndex]);
|
||||||
if (!this.isServerAvailable(connection)) {
|
if (!this.isServerAvailable(connection)) {
|
||||||
|
@ -107,6 +107,7 @@ export default class DHT {
|
||||||
}
|
}
|
||||||
const node = new DhtNode(new Stream(true, new WebSocket(connection)), this._options);
|
const node = new DhtNode(new Stream(true, new WebSocket(connection)), this._options);
|
||||||
this._activeRelays.set(available[relayIndex], node);
|
this._activeRelays.set(available[relayIndex], node);
|
||||||
|
updateAvailable();
|
||||||
relayPromises.push(node.ready());
|
relayPromises.push(node.ready());
|
||||||
}
|
}
|
||||||
return Promise.allSettled(relayPromises);
|
return Promise.allSettled(relayPromises);
|
||||||
|
|
Loading…
Reference in New Issue