Skip to content

Commit 323c2d6

Browse files
committed
les: add missing nil check and handle quit in findServers
1 parent 09baeec commit 323c2d6

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

‎les/handler.go‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ func (pm *ProtocolManager) removePeer(id string) {
236236
}
237237

238238
func (pm *ProtocolManager) findServers() {
239-
if pm.p2pServer == nil {
239+
if pm.p2pServer == nil || pm.topicDisc == nil {
240240
return
241241
}
242242
enodes := make(chan string, 100)
@@ -259,7 +259,10 @@ func (pm *ProtocolManager) findServers() {
259259
}
260260
}
261261
}()
262-
time.Sleep(time.Second * 20)
262+
select {
263+
case <-time.After(time.Second * 20):
264+
case <-pm.quitSync:
265+
}
263266
close(stop)
264267
}
265268

0 commit comments

Comments
 (0)