forked from cerc-io/plugeth
Properly list caps
This commit is contained in:
parent
f76f953f0c
commit
0c4adeceae
3
peer.go
3
peer.go
@ -673,6 +673,7 @@ func (p *Peer) pushPeers() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (self *Peer) pushStatus() {
|
func (self *Peer) pushStatus() {
|
||||||
|
fmt.Println("push status")
|
||||||
msg := wire.NewMessage(wire.MsgStatusTy, []interface{}{
|
msg := wire.NewMessage(wire.MsgStatusTy, []interface{}{
|
||||||
uint32(ProtocolVersion),
|
uint32(ProtocolVersion),
|
||||||
uint32(NetVersion),
|
uint32(NetVersion),
|
||||||
@ -825,7 +826,7 @@ func (p *Peer) handleHandshake(msg *wire.Msg) {
|
|||||||
p.pushStatus()
|
p.pushStatus()
|
||||||
}
|
}
|
||||||
|
|
||||||
capsStrs = append(capsStrs, cap)
|
capsStrs = append(capsStrs, fmt.Sprintf("%s/%d", cap, ver))
|
||||||
}
|
}
|
||||||
|
|
||||||
peerlogger.Infof("Added peer (%s) %d / %d (%v)\n", p.conn.RemoteAddr(), p.ethereum.Peers().Len(), p.ethereum.MaxPeers, capsStrs)
|
peerlogger.Infof("Added peer (%s) %d / %d (%v)\n", p.conn.RemoteAddr(), p.ethereum.Peers().Len(), p.ethereum.MaxPeers, capsStrs)
|
||||||
|
@ -176,10 +176,12 @@ func NewJSPeer(peer chain.Peer) *JSPeer {
|
|||||||
var caps []string
|
var caps []string
|
||||||
capsIt := peer.Caps().NewIterator()
|
capsIt := peer.Caps().NewIterator()
|
||||||
for capsIt.Next() {
|
for capsIt.Next() {
|
||||||
caps = append(caps, capsIt.Value().Str())
|
cap := capsIt.Value().Get(0).Str()
|
||||||
|
ver := capsIt.Value().Get(1).Uint()
|
||||||
|
caps = append(caps, fmt.Sprintf("%s/%d", cap, ver))
|
||||||
}
|
}
|
||||||
|
|
||||||
return &JSPeer{ref: &peer, Inbound: peer.Inbound(), LastSend: peer.LastSend().Unix(), LastPong: peer.LastPong(), Version: peer.Version(), Ip: ipAddress, Port: int(peer.Port()), Latency: peer.PingTime(), Caps: fmt.Sprintf("%v", caps)}
|
return &JSPeer{ref: &peer, Inbound: peer.Inbound(), LastSend: peer.LastSend().Unix(), LastPong: peer.LastPong(), Version: peer.Version(), Ip: ipAddress, Port: int(peer.Port()), Latency: peer.PingTime(), Caps: "[" + strings.Join(caps, ", ") + "]"}
|
||||||
}
|
}
|
||||||
|
|
||||||
type JSReceipt struct {
|
type JSReceipt struct {
|
||||||
|
Loading…
Reference in New Issue
Block a user