From 2925dc3f07d6dca317c63a9ca9f511b0379cdb5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Fri, 3 Jun 2016 11:05:25 +0300 Subject: [PATCH] eth/downloader: fix string formatting per review requests --- eth/downloader/downloader.go | 4 ++-- eth/downloader/peer.go | 17 +++++++++-------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/eth/downloader/downloader.go b/eth/downloader/downloader.go index 2f371d8f06..08b685ff8a 100644 --- a/eth/downloader/downloader.go +++ b/eth/downloader/downloader.go @@ -1903,7 +1903,7 @@ func (d *Downloader) qosTuner() { atomic.StoreUint64(&d.rttConfidence, conf) // Log the new QoS values and sleep until the next RTT - glog.V(logger.Debug).Infof("quality of service: rtt %v, conf %.3f, ttl %v", rtt, float64(conf)/1000000.0, d.requestTTL()) + glog.V(logger.Debug).Infof("Quality of service: rtt %v, conf %.3f, ttl %v", rtt, float64(conf)/1000000.0, d.requestTTL()) time.Sleep(rtt) } } @@ -1929,7 +1929,7 @@ func (d *Downloader) qosReduceConfidence() { atomic.StoreUint64(&d.rttConfidence, conf) rtt := time.Duration(atomic.LoadUint64(&d.rttEstimate)) - glog.V(logger.Debug).Infof("quality of service: rtt %v, conf %.3f, ttl %v", rtt, float64(conf)/1000000.0, d.requestTTL()) + glog.V(logger.Debug).Infof("Quality of service: rtt %v, conf %.3f, ttl %v", rtt, float64(conf)/1000000.0, d.requestTTL()) } // requestRTT returns the current target round trip time for a download request diff --git a/eth/downloader/peer.go b/eth/downloader/peer.go index 32bce1628f..a538cad886 100644 --- a/eth/downloader/peer.go +++ b/eth/downloader/peer.go @@ -23,6 +23,7 @@ import ( "errors" "fmt" "math" + "strings" "sync" "sync/atomic" "time" @@ -366,14 +367,14 @@ func (p *peer) String() string { p.lock.RLock() defer p.lock.RUnlock() - return fmt.Sprintf("Peer %s [%s]", p.id, - fmt.Sprintf("hs %3.2f/s, ", p.headerThroughput)+ - fmt.Sprintf("bs %3.2f/s, ", p.blockThroughput)+ - fmt.Sprintf("rs %3.2f/s, ", p.receiptThroughput)+ - fmt.Sprintf("ss %3.2f/s, ", p.stateThroughput)+ - fmt.Sprintf("miss %4d, ", len(p.lacking))+ - fmt.Sprintf("rtt %v", p.rtt), - ) + return fmt.Sprintf("Peer %s [%s]", p.id, strings.Join([]string{ + fmt.Sprintf("hs %3.2f/s", p.headerThroughput), + fmt.Sprintf("bs %3.2f/s", p.blockThroughput), + fmt.Sprintf("rs %3.2f/s", p.receiptThroughput), + fmt.Sprintf("ss %3.2f/s", p.stateThroughput), + fmt.Sprintf("miss %4d", len(p.lacking)), + fmt.Sprintf("rtt %v", p.rtt), + }, ", ")) } // peerSet represents the collection of active peer participating in the chain