diff options
author | Maran <maran.hidskes@gmail.com> | 2014-06-03 16:42:55 +0800 |
---|---|---|
committer | Maran <maran.hidskes@gmail.com> | 2014-06-03 16:42:55 +0800 |
commit | 2010fea0888991e978e715477516bc374bb29f01 (patch) | |
tree | 1853e885d4b41bca0cb974a5c58b871406cbc2ad /ethpub | |
parent | fb6ff61730ed92ada68c9c5a5b3a6f9976a78161 (diff) | |
download | go-tangerine-2010fea0888991e978e715477516bc374bb29f01.tar go-tangerine-2010fea0888991e978e715477516bc374bb29f01.tar.gz go-tangerine-2010fea0888991e978e715477516bc374bb29f01.tar.bz2 go-tangerine-2010fea0888991e978e715477516bc374bb29f01.tar.lz go-tangerine-2010fea0888991e978e715477516bc374bb29f01.tar.xz go-tangerine-2010fea0888991e978e715477516bc374bb29f01.tar.zst go-tangerine-2010fea0888991e978e715477516bc374bb29f01.zip |
Added faux latency for peeroverview
Diffstat (limited to 'ethpub')
-rw-r--r-- | ethpub/pub.go | 1 | ||||
-rw-r--r-- | ethpub/types.go | 3 |
2 files changed, 3 insertions, 1 deletions
diff --git a/ethpub/pub.go b/ethpub/pub.go index 6d4c230ad..e00bd0dbe 100644 --- a/ethpub/pub.go +++ b/ethpub/pub.go @@ -56,6 +56,7 @@ func (lib *PEthereum) GetPeers() []PPeer { var peers []PPeer for peer := lib.manager.Peers().Front(); peer != nil; peer = peer.Next() { p := peer.Value.(ethchain.Peer) + // we only want connected peers if atomic.LoadInt32(p.Connected()) != 0 { peers = append(peers, *NewPPeer(p)) } diff --git a/ethpub/types.go b/ethpub/types.go index 1079f09b4..4967eda49 100644 --- a/ethpub/types.go +++ b/ethpub/types.go @@ -20,6 +20,7 @@ type PPeer struct { Port int `json:"port"` Version string `json:"version"` LastResponse string `json:"lastResponse"` + Latency string `json:"latency"` } func NewPPeer(peer ethchain.Peer) *PPeer { @@ -34,7 +35,7 @@ func NewPPeer(peer ethchain.Peer) *PPeer { } ipAddress := strings.Join(ip, ".") - return &PPeer{ref: &peer, Inbound: peer.Inbound(), LastSend: peer.LastSend().Unix(), LastPong: peer.LastPong(), Version: peer.Version(), Ip: ipAddress, Port: int(peer.Port())} + return &PPeer{ref: &peer, Inbound: peer.Inbound(), LastSend: peer.LastSend().Unix(), LastPong: peer.LastPong(), Version: peer.Version(), Ip: ipAddress, Port: int(peer.Port()), Latency: peer.PingTime()} } // Block interface exposed to QML |