diff options
author | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-02-17 23:22:41 +0800 |
---|---|---|
committer | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-02-17 23:22:41 +0800 |
commit | 5022b618aa73e29decf19399d78190a06bdda81d (patch) | |
tree | d2e0d9853a085d78a6d620487cb0171091b174a2 | |
parent | 5238b9439eae0e60b88c65ef33274200f9c734fb (diff) | |
parent | 7ea131d4ffddaae15c697fe0d025ff431bacc01a (diff) | |
download | go-tangerine-5022b618aa73e29decf19399d78190a06bdda81d.tar go-tangerine-5022b618aa73e29decf19399d78190a06bdda81d.tar.gz go-tangerine-5022b618aa73e29decf19399d78190a06bdda81d.tar.bz2 go-tangerine-5022b618aa73e29decf19399d78190a06bdda81d.tar.lz go-tangerine-5022b618aa73e29decf19399d78190a06bdda81d.tar.xz go-tangerine-5022b618aa73e29decf19399d78190a06bdda81d.tar.zst go-tangerine-5022b618aa73e29decf19399d78190a06bdda81d.zip |
Merge pull request #327 from fjl/udp-out-of-range
p2p/discover: fix pending replies iteration
-rw-r--r-- | p2p/discover/udp.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/p2p/discover/udp.go b/p2p/discover/udp.go index b2a895442..69e9f3c2e 100644 --- a/p2p/discover/udp.go +++ b/p2p/discover/udp.go @@ -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:]) |