*Update dist
This commit is contained in:
parent
ee4c552fb4
commit
08dee10521
|
@ -1,6 +1,7 @@
|
|||
/// <reference types="node" />
|
||||
/// <reference types="node" />
|
||||
import EventEmitter from "events";
|
||||
export declare const FLOOD_SYMBOL: unique symbol;
|
||||
export default class DHTFlood extends EventEmitter {
|
||||
private id;
|
||||
private ttl;
|
||||
|
|
|
@ -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"}
|
||||
{"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"}
|
|
@ -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");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue