Browse Source

add destroyed flag

session-estimator
Mathias Buus 3 years ago
parent
commit
b9932daf94
  1. 2
      index.js

2
index.js

@ -38,6 +38,7 @@ class DHT extends EventEmitter {
this.ephemeral = true this.ephemeral = true
this.firewalled = this.io.firewalled this.firewalled = this.io.firewalled
this.adaptive = typeof opts.ephemeral !== 'boolean' && opts.adaptive !== false this.adaptive = typeof opts.ephemeral !== 'boolean' && opts.adaptive !== false
this.destroyed = false
this._nat = new NatSampler() this._nat = new NatSampler()
this._bind = opts.bind || 0 this._bind = opts.bind || 0
@ -193,6 +194,7 @@ class DHT extends EventEmitter {
} }
destroy () { destroy () {
this.destroyed = true
clearInterval(this._tickInterval) clearInterval(this._tickInterval)
return this.io.destroy() return this.io.destroy()
} }

Loading…
Cancel
Save