aboutsummaryrefslogtreecommitdiffstats
path: root/p2p/discover/udp.go
diff options
context:
space:
mode:
authorsubtly <subtly@users.noreply.github.com>2015-05-14 02:03:17 +0800
committersubtly <subtly@users.noreply.github.com>2015-05-14 02:03:17 +0800
commita32693770c607a17eab6d8d068e4c9b1cddbbd54 (patch)
tree62fe9bb0c7bda86238bc2d0260b958d6a1234ce9 /p2p/discover/udp.go
parent7473c93668e42cfc13c89ab660b6ea262ebf9bf4 (diff)
downloaddexon-a32693770c607a17eab6d8d068e4c9b1cddbbd54.tar
dexon-a32693770c607a17eab6d8d068e4c9b1cddbbd54.tar.gz
dexon-a32693770c607a17eab6d8d068e4c9b1cddbbd54.tar.bz2
dexon-a32693770c607a17eab6d8d068e4c9b1cddbbd54.tar.lz
dexon-a32693770c607a17eab6d8d068e4c9b1cddbbd54.tar.xz
dexon-a32693770c607a17eab6d8d068e4c9b1cddbbd54.tar.zst
dexon-a32693770c607a17eab6d8d068e4c9b1cddbbd54.zip
Manual send of multiple neighbours packets. Test receiving multiple neighbours packets.
Diffstat (limited to 'p2p/discover/udp.go')
-rw-r--r--p2p/discover/udp.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/p2p/discover/udp.go b/p2p/discover/udp.go
index ab3559ad8..2b215b45c 100644
--- a/p2p/discover/udp.go
+++ b/p2p/discover/udp.go
@@ -510,9 +510,15 @@ func (req *findnode) handle(t *udp, from *net.UDPAddr, fromID NodeID, mac []byte
closestrpc[i] = nodeToRPC(n)
}
t.send(from, neighborsPacket, neighbors{
- Nodes: closestrpc,
+ Nodes: closestrpc[:13],
Expiration: uint64(time.Now().Add(expiration).Unix()),
})
+ if len(closestrpc) > 13 {
+ t.send(from, neighborsPacket, neighbors{
+ Nodes: closestrpc[13:],
+ Expiration: uint64(time.Now().Add(expiration).Unix()),
+ })
+ }
return nil
}