diff options
author | obscuren <geffobscura@gmail.com> | 2014-09-16 22:36:27 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-09-16 22:36:27 +0800 |
commit | 1549a29c9d6452eefa615baedfccfc5b5f6b7745 (patch) | |
tree | 01f228055aaf8c1411e9466fbc53efc4f5600a18 /peer.go | |
parent | 66e309c5c4fb1faebe7338053481024eeb55a2d1 (diff) | |
download | dexon-1549a29c9d6452eefa615baedfccfc5b5f6b7745.tar.gz dexon-1549a29c9d6452eefa615baedfccfc5b5f6b7745.tar.zst dexon-1549a29c9d6452eefa615baedfccfc5b5f6b7745.zip |
Connect to previous peer
Diffstat (limited to 'peer.go')
-rw-r--r-- | peer.go | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -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 { |