Skip to content

Commit

Permalink
les: add missing nil check and handle quit in findServers
Browse files Browse the repository at this point in the history
  • Loading branch information
zsfelfoldi committed Nov 11, 2016
1 parent 09baeec commit 323c2d6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions les/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ func (pm *ProtocolManager) removePeer(id string) {
}

func (pm *ProtocolManager) findServers() {
if pm.p2pServer == nil {
if pm.p2pServer == nil || pm.topicDisc == nil {
return
}
enodes := make(chan string, 100)
Expand All @@ -259,7 +259,10 @@ func (pm *ProtocolManager) findServers() {
}
}
}()
time.Sleep(time.Second * 20)
select {
case <-time.After(time.Second * 20):
case <-pm.quitSync:
}
close(stop)
}

Expand Down

0 comments on commit 323c2d6

Please sign in to comment.