aboutsummaryrefslogtreecommitdiffstats
path: root/les/handler.go
diff options
context:
space:
mode:
authorZsolt Felfoldi <zsfelfoldi@gmail.com>2016-11-11 10:16:46 +0800
committerZsolt Felfoldi <zsfelfoldi@gmail.com>2016-11-11 10:16:46 +0800
commit323c2d6775c86c063e9048ef0e8605283f07cafb (patch)
tree10968d9fda64d5fdc81a272af2e82cf0e161dc00 /les/handler.go
parent09baeec0dabc24050f344272ed36e39687c2b4e8 (diff)
downloaddexon-323c2d6775c86c063e9048ef0e8605283f07cafb.tar
dexon-323c2d6775c86c063e9048ef0e8605283f07cafb.tar.gz
dexon-323c2d6775c86c063e9048ef0e8605283f07cafb.tar.bz2
dexon-323c2d6775c86c063e9048ef0e8605283f07cafb.tar.lz
dexon-323c2d6775c86c063e9048ef0e8605283f07cafb.tar.xz
dexon-323c2d6775c86c063e9048ef0e8605283f07cafb.tar.zst
dexon-323c2d6775c86c063e9048ef0e8605283f07cafb.zip
les: add missing nil check and handle quit in findServers
Diffstat (limited to 'les/handler.go')
-rw-r--r--les/handler.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/les/handler.go b/les/handler.go
index 44a0a1661..cf698d79c 100644
--- a/les/handler.go
+++ b/les/handler.go
@@ -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)
@@ -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)
}