From 08dee10521e48b95a3c1c071b566a8e26f34eda0 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Wed, 16 Nov 2022 01:33:52 -0500 Subject: [PATCH] *Update dist --- dist/index.d.ts | 1 + dist/index.d.ts.map | 2 +- dist/index.js | 10 ++++++---- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/dist/index.d.ts b/dist/index.d.ts index 2477f02..83ff0d9 100644 --- a/dist/index.d.ts +++ b/dist/index.d.ts @@ -1,6 +1,7 @@ /// /// import EventEmitter from "events"; +export declare const FLOOD_SYMBOL: unique symbol; export default class DHTFlood extends EventEmitter { private id; private ttl; diff --git a/dist/index.d.ts.map b/dist/index.d.ts.map index 69d447e..7f6d025 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":";;AAAA,OAAO,YAAY,MAAM,QAAQ,CAAC;AAoBlC,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,YAAY;IAChD,OAAO,CAAC,EAAE,CAAS;IACnB,OAAO,CAAC,GAAG,CAAS;IACpB,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,GAAG,CAAM;IACjB,OAAO,CAAC,KAAK,CAAM;gBAEP,EACV,OAAkB,EAClB,GAAS,EACT,aAAiB,EACjB,EAA2B,EAC3B,KAAY,GACb;;;;;;KAAK;IAkBN,OAAO,CAAC,aAAa;IAiCrB,OAAO,CAAC,SAAS;IA6CjB,SAAS,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,SAAW;IAenC,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,SAAW;CAY1C"} \ No newline at end of file +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAAA,OAAO,YAAY,MAAM,QAAQ,CAAC;AAkBlC,eAAO,MAAM,YAAY,eAAuB,CAAC;AAEjD,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,YAAY;IAChD,OAAO,CAAC,EAAE,CAAS;IACnB,OAAO,CAAC,GAAG,CAAS;IACpB,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,GAAG,CAAM;IACjB,OAAO,CAAC,KAAK,CAAM;gBAEP,EACV,OAAkB,EAClB,GAAS,EACT,aAAiB,EACjB,EAA2B,EAC3B,KAAY,GACb;;;;;;KAAK;IAkBN,OAAO,CAAC,aAAa;IAkCrB,OAAO,CAAC,SAAS;IA6CjB,SAAS,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,SAAW;IAenC,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,SAAW;CAY1C"} \ No newline at end of file diff --git a/dist/index.js b/dist/index.js index f95eb4a..7f1ebef 100644 --- a/dist/index.js +++ b/dist/index.js @@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); +exports.FLOOD_SYMBOL = void 0; const events_1 = __importDefault(require("events")); const crypto_1 = __importDefault(require("crypto")); // @ts-ignore @@ -18,7 +19,7 @@ const debug = (0, debug_1.default)("dht-flood"); const LRU_SIZE = 255; const TTL = 255; const PROTOCOL = "lumeweb.flood"; -const FLOOD_SYMBOL = Symbol.for(PROTOCOL); +exports.FLOOD_SYMBOL = Symbol.for(PROTOCOL); class DHTFlood extends events_1.default { id; ttl; @@ -51,8 +52,9 @@ class DHTFlood extends events_1.default { return debug("Got message that was already seen", originId, messageNumber); this.lru.set(key, true); this.emit("message", data, originId, messageNumber); - if (ttl <= 0) + if (ttl <= 0) { return debug("Got message at end of TTL", originId, messageNumber, ttl); + } messenger.send({ originId, messageNumber, @@ -74,9 +76,9 @@ class DHTFlood extends events_1.default { self.emit("peer-remove", peer); }, }); - peer[FLOOD_SYMBOL] = chan; + peer[exports.FLOOD_SYMBOL] = chan; } - chan = peer[FLOOD_SYMBOL]; + chan = peer[exports.FLOOD_SYMBOL]; if (!chan) { throw new Error("could not find channel"); }