diff --git a/les/handler.go b/les/handler.go index 44a0a1661b6e83dc4abdb481668d0b34165a6ca6..cf698d79cd6177604c4b8a23f3f0d9542289ba88 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) } diff --git a/p2p/discv5/net.go b/p2p/discv5/net.go index afc92e99fbf149ca9fe31097998cee59f5fd1b7c..b08cd2bc7685b03a26a40023fdd6a027f30d2e3f 100644 --- a/p2p/discv5/net.go +++ b/p2p/discv5/net.go @@ -863,6 +863,9 @@ func init() { name: "verifywait", handle: func(net *Network, n *Node, ev nodeEvent, pkt *ingressPacket) (*nodeState, error) { switch ev { + case pingPacket: + net.handlePing(n, pkt) + return verifywait, nil case pongPacket: err := net.handleKnownPong(n, pkt) return known, err