From 8ee4df8d1bc2c08f74b1f6da4b3bafcf02faeeab Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Tue, 26 Jul 2022 23:00:19 -0400 Subject: [PATCH] *Update dist --- dist/index.d.ts.map | 2 +- dist/index.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dist/index.d.ts.map b/dist/index.d.ts.map index c47cef3..7565981 100644 --- a/dist/index.d.ts.map +++ b/dist/index.d.ts.map @@ -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;CAkC9B;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,CAEvD"} \ No newline at end of file +{"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;CA+B9B;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,CAEvD"} \ No newline at end of file diff --git a/dist/index.js b/dist/index.js index 93e6555..44425b5 100644 --- a/dist/index.js +++ b/dist/index.js @@ -97,11 +97,11 @@ export default class DHT { while (this._activeRelays.size <= Math.min(this._maxConnections, available.length + this._activeRelays.size)) { const relayIndex = await randomNumber(0, available.length - 1); - const connection = available[relayIndex]; + const connection = this._relays.get(available[relayIndex]); if (!this.isServerAvailable(connection)) { continue; } - const node = new DhtNode(new Stream(true, new WebSocket(this._relays.get(connection))), this._options); + const node = new DhtNode(new Stream(true, new WebSocket(connection)), this._options); this._activeRelays.set(available[relayIndex], node); relayPromises.push(node.ready()); }