Commit 323c2d67 authored by Zsolt Felfoldi's avatar Zsolt Felfoldi

les: add missing nil check and handle quit in findServers

parent 09baeec0
...@@ -236,7 +236,7 @@ func (pm *ProtocolManager) removePeer(id string) { ...@@ -236,7 +236,7 @@ func (pm *ProtocolManager) removePeer(id string) {
} }
func (pm *ProtocolManager) findServers() { func (pm *ProtocolManager) findServers() {
if pm.p2pServer == nil { if pm.p2pServer == nil || pm.topicDisc == nil {
return return
} }
enodes := make(chan string, 100) enodes := make(chan string, 100)
...@@ -259,7 +259,10 @@ func (pm *ProtocolManager) findServers() { ...@@ -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) close(stop)
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment