aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2015-02-17 23:22:41 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2015-02-17 23:22:41 +0800
commit5022b618aa73e29decf19399d78190a06bdda81d (patch)
treed2e0d9853a085d78a6d620487cb0171091b174a2
parent5238b9439eae0e60b88c65ef33274200f9c734fb (diff)
parent7ea131d4ffddaae15c697fe0d025ff431bacc01a (diff)
downloaddexon-5022b618aa73e29decf19399d78190a06bdda81d.tar.gz
dexon-5022b618aa73e29decf19399d78190a06bdda81d.tar.zst
dexon-5022b618aa73e29decf19399d78190a06bdda81d.zip
Merge pull request #327 from fjl/udp-out-of-range
p2p/discover: fix pending replies iteration
-rw-r--r--p2p/discover/udp.go3
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:])