aboutsummaryrefslogtreecommitdiffstats
path: root/peer.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-09-16 22:36:27 +0800
committerobscuren <geffobscura@gmail.com>2014-09-16 22:36:27 +0800
commit1549a29c9d6452eefa615baedfccfc5b5f6b7745 (patch)
tree01f228055aaf8c1411e9466fbc53efc4f5600a18 /peer.go
parent66e309c5c4fb1faebe7338053481024eeb55a2d1 (diff)
downloadgo-tangerine-1549a29c9d6452eefa615baedfccfc5b5f6b7745.tar.gz
go-tangerine-1549a29c9d6452eefa615baedfccfc5b5f6b7745.tar.zst
go-tangerine-1549a29c9d6452eefa615baedfccfc5b5f6b7745.zip
Connect to previous peer
Diffstat (limited to 'peer.go')
-rw-r--r--peer.go12
1 files changed, 9 insertions, 3 deletions
diff --git a/peer.go b/peer.go
index 69aa4b668..628953535 100644
--- a/peer.go
+++ b/peer.go
@@ -680,7 +680,7 @@ func (p *Peer) handleHandshake(msg *ethwire.Msg) {
var (
p2pVersion = c.Get(0).Uint()
clientId = c.Get(1).Str()
- caps = c.Get(2).Raw()
+ caps = c.Get(2)
port = c.Get(3).Uint()
pub = c.Get(4).Bytes()
)
@@ -734,11 +734,17 @@ func (p *Peer) handleHandshake(msg *ethwire.Msg) {
p.ethereum.PushPeer(p)
p.ethereum.reactor.Post("peerList", p.ethereum.Peers())
- ethlogger.Infof("Added peer (%s) %d / %d (%v)\n", p.conn.RemoteAddr(), p.ethereum.Peers().Len(), p.ethereum.MaxPeers, caps)
+ ethlogger.Infof("Added peer (%s) %d / %d (%v)\n", p.conn.RemoteAddr(), p.ethereum.Peers().Len(), p.ethereum.MaxPeers, caps.Raw())
peerlogger.Debugln(p)
- p.pushStatus()
+ capsIt := caps.NewIterator()
+ for capsIt.Next() {
+ switch capsIt.Value().Str() {
+ case "eth":
+ p.pushStatus()
+ }
+ }
}
func (p *Peer) String() string {