Skip to content

Commit 932d973

Browse files
authored
Merge pull request #3248 from zsfelfoldi/light-topic3
Topic discovery bugfix
2 parents 9eb6f62 + 323c2d6 commit 932d973

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

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

p2p/discv5/net.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -863,6 +863,9 @@ func init() {
863863
name: "verifywait",
864864
handle: func(net *Network, n *Node, ev nodeEvent, pkt *ingressPacket) (*nodeState, error) {
865865
switch ev {
866+
case pingPacket:
867+
net.handlePing(n, pkt)
868+
return verifywait, nil
866869
case pongPacket:
867870
err := net.handleKnownPong(n, pkt)
868871
return known, err

0 commit comments

Comments
 (0)