aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaran <maran.hidskes@gmail.com>2014-05-12 22:09:23 +0800
committerMaran <maran.hidskes@gmail.com>2014-05-12 22:09:23 +0800
commit8fe0864680b40c3fa5e47775856d8ae1997ba003 (patch)
treee630d242901e872a7047e7f600e2e797a84be56a
parent5fcbaefd0b20af2a13ad9f6c3359b8c1ca096ba6 (diff)
downloaddexon-8fe0864680b40c3fa5e47775856d8ae1997ba003.tar.gz
dexon-8fe0864680b40c3fa5e47775856d8ae1997ba003.tar.zst
dexon-8fe0864680b40c3fa5e47775856d8ae1997ba003.zip
Only accept peers if we asked for them
-rw-r--r--peer.go28
1 files changed, 14 insertions, 14 deletions
diff --git a/peer.go b/peer.go
index d8168e455..359e83566 100644
--- a/peer.go
+++ b/peer.go
@@ -401,22 +401,22 @@ func (p *Peer) HandleInbound() {
case ethwire.MsgPeersTy:
// Received a list of peers (probably because MsgGetPeersTy was send)
// Only act on message if we actually requested for a peers list
- //if p.requestedPeerList {
- data := msg.Data
- // Create new list of possible peers for the ethereum to process
- peers := make([]string, data.Len())
- // Parse each possible peer
- for i := 0; i < data.Len(); i++ {
- value := data.Get(i)
- peers[i] = unpackAddr(value.Get(0), value.Get(1).Uint())
- }
+ if p.requestedPeerList {
+ data := msg.Data
+ // Create new list of possible peers for the ethereum to process
+ peers := make([]string, data.Len())
+ // Parse each possible peer
+ for i := 0; i < data.Len(); i++ {
+ value := data.Get(i)
+ peers[i] = unpackAddr(value.Get(0), value.Get(1).Uint())
+ }
- // Connect to the list of peers
- p.ethereum.ProcessPeerList(peers)
- // Mark unrequested again
- p.requestedPeerList = false
+ // Connect to the list of peers
+ p.ethereum.ProcessPeerList(peers)
+ // Mark unrequested again
+ p.requestedPeerList = false
- //}
+ }
case ethwire.MsgGetChainTy:
var parent *ethchain.Block
// Length minus one since the very last element in the array is a count