From 77cec590833aab2c212c7fe0097abebc5ae1ecc1 Mon Sep 17 00:00:00 2001
From: Jeromy <jeromyj@gmail.com>
Date: Fri, 10 Oct 2014 05:41:15 +0000
Subject: [PATCH] actually put diagCmd into the super command so it can be run

---
 cmd/ipfs/ipfs.go | 1 +
 peer/peer.go     | 6 +++++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/cmd/ipfs/ipfs.go b/cmd/ipfs/ipfs.go
index f5e645bcf..b7d887a3d 100644
--- a/cmd/ipfs/ipfs.go
+++ b/cmd/ipfs/ipfs.go
@@ -59,6 +59,7 @@ Use "ipfs help <command>" for more information about a command.
 		cmdIpfsRun,
 		cmdIpfsName,
 		cmdIpfsBootstrap,
+		cmdIpfsDiag,
 	},
 	Flag: *flag.NewFlagSet("ipfs", flag.ExitOnError),
 }
diff --git a/peer/peer.go b/peer/peer.go
index ab071ea52..0961f3408 100644
--- a/peer/peer.go
+++ b/peer/peer.go
@@ -105,6 +105,10 @@ func (p *Peer) GetLatency() (out time.Duration) {
 // Yep, should be EWMA or something. (-jbenet)
 func (p *Peer) SetLatency(laten time.Duration) {
 	p.Lock()
-	p.latency = laten
+	if p.latency == 0 {
+		p.latency = laten
+	} else {
+		p.latency = ((p.latency * 9) + laten) / 10
+	}
 	p.Unlock()
 }
-- 
GitLab