From b9932daf949da0ecfef8f95b59d10ed3597b379a Mon Sep 17 00:00:00 2001 From: Mathias Buus Date: Thu, 7 Oct 2021 15:35:48 +0200 Subject: [PATCH] add destroyed flag --- index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/index.js b/index.js index d319373..c804586 100644 --- a/index.js +++ b/index.js @@ -38,6 +38,7 @@ class DHT extends EventEmitter { this.ephemeral = true this.firewalled = this.io.firewalled this.adaptive = typeof opts.ephemeral !== 'boolean' && opts.adaptive !== false + this.destroyed = false this._nat = new NatSampler() this._bind = opts.bind || 0 @@ -193,6 +194,7 @@ class DHT extends EventEmitter { } destroy () { + this.destroyed = true clearInterval(this._tickInterval) return this.io.destroy() }