[tor-commits] [snowflake/master] use const LogTimeInterval
serene at torproject.org
serene at torproject.org
Fri Mar 4 21:22:53 UTC 2016
commit 8a8273e972f8a0d9496da7f6af47e34899c07f14
Author: Serene Han <keroserene+git at gmail.com>
Date: Sun Feb 28 13:16:12 2016 -0800
use const LogTimeInterval
---
client/util.go | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/client/util.go b/client/util.go
index fa04220..abefa04 100644
--- a/client/util.go
+++ b/client/util.go
@@ -5,6 +5,10 @@ import (
"time"
)
+const (
+ LogTimeInterval = 5
+)
+
type BytesInfo struct {
outboundChan chan int
inboundChan chan int
@@ -33,18 +37,18 @@ func (b *BytesInfo) Log() {
b.outbound += amount
b.outEvents++
last := time.Now()
- if time.Since(last) > time.Second*5 {
+ if time.Since(last) > time.Second*LogTimeInterval {
last = time.Now()
output()
}
case amount = <-b.inboundChan:
b.inbound += amount
b.inEvents++
- if time.Since(last) > time.Second*5 {
+ if time.Since(last) > time.Second*LogTimeInterval {
last = time.Now()
output()
}
- case <-time.After(time.Second * 5):
+ case <-time.After(time.Second * LogTimeInterval):
if b.inEvents > 0 || b.outEvents > 0 {
output()
}
More information about the tor-commits
mailing list