Skip to content

Commit

Permalink
p2p: close node DB after closing discovery
Browse files Browse the repository at this point in the history
This fixes a leveldb crash in tests.
  • Loading branch information
fjl committed Oct 11, 2018
1 parent 91025b7 commit 0056c2e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions p2p/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,6 @@ func (srv *Server) Stop() {
return
}
srv.running = false
srv.nodedb.Close()
if srv.listener != nil {
// this unblocks listener Accept
srv.listener.Close()
Expand Down Expand Up @@ -605,8 +604,9 @@ type dialer interface {

func (srv *Server) run(dialstate dialer) {
srv.log.Info("Started P2P networking", "self", srv.localnode.Node())

defer srv.loopWG.Done()
defer srv.nodedb.Close()

var (
peers = make(map[enode.ID]*Peer)
inboundCount = 0
Expand Down

0 comments on commit 0056c2e

Please sign in to comment.