mirror of
https://gitlab.com/pulsechaincom/go-pulse.git
synced 2024-12-25 21:07:17 +00:00
Merge pull request #327 from fjl/udp-out-of-range
p2p/discover: fix pending replies iteration
This commit is contained in:
commit
5022b618aa
@ -253,7 +253,8 @@ func (t *udp) loop() {
|
||||
|
||||
case reply := <-t.replies:
|
||||
// run matching callbacks, remove if they return false.
|
||||
for i, p := range pending {
|
||||
for i := 0; i < len(pending); i++ {
|
||||
p := pending[i]
|
||||
if reply.from == p.from && reply.ptype == p.ptype && p.callback(reply.data) {
|
||||
p.errc <- nil
|
||||
copy(pending[i:], pending[i+1:])
|
||||
|
Loading…
Reference in New Issue
Block a user