aboutsummaryrefslogtreecommitdiffstats
path: root/ethpub
diff options
context:
space:
mode:
authorMaran <maran.hidskes@gmail.com>2014-06-03 16:42:55 +0800
committerMaran <maran.hidskes@gmail.com>2014-06-03 16:42:55 +0800
commit2010fea0888991e978e715477516bc374bb29f01 (patch)
tree1853e885d4b41bca0cb974a5c58b871406cbc2ad /ethpub
parentfb6ff61730ed92ada68c9c5a5b3a6f9976a78161 (diff)
downloaddexon-2010fea0888991e978e715477516bc374bb29f01.tar
dexon-2010fea0888991e978e715477516bc374bb29f01.tar.gz
dexon-2010fea0888991e978e715477516bc374bb29f01.tar.bz2
dexon-2010fea0888991e978e715477516bc374bb29f01.tar.lz
dexon-2010fea0888991e978e715477516bc374bb29f01.tar.xz
dexon-2010fea0888991e978e715477516bc374bb29f01.tar.zst
dexon-2010fea0888991e978e715477516bc374bb29f01.zip
Added faux latency for peeroverview
Diffstat (limited to 'ethpub')
-rw-r--r--ethpub/pub.go1
-rw-r--r--ethpub/types.go3
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