Skip to content
This repository has been archived by the owner on Jul 21, 2023. It is now read-only.

Commit

Permalink
fix: random walk should not be started by kad-dht
Browse files Browse the repository at this point in the history
  • Loading branch information
vasco-santos committed Sep 24, 2018
1 parent c69c1a3 commit 45dfb33
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,7 @@ class KadDHT {
*/
start (callback) {
this._running = true
this.network.start((err) => {
if (err) {
return callback(err)
}
this.randomWalk.start()

callback()
})
this.network.start(callback)
}

/**
Expand All @@ -134,7 +127,7 @@ class KadDHT {
*/
stop (callback) {
this._running = false
this.randomWalk.stop(() => {
this.randomWalk.stop(() => { // guarantee that random walk is stopped if it was started
this.providers.stop()
this.network.stop(callback)
})
Expand Down

0 comments on commit 45dfb33

Please sign in to comment.