aboutsummaryrefslogtreecommitdiffstats
path: root/p2p
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2015-08-27 06:03:59 +0800
committerFelix Lange <fjl@twurst.com>2015-08-27 06:03:59 +0800
commit6ec13e7e2bab1ebdb580819a48629055bbbb5fb3 (patch)
treecd23c3deac1a41b34a5157c1f7c5361ca56b4137 /p2p
parent79b644c7a35bbc835b7e78ddf8a31c37e69b0784 (diff)
parent17f65cd1e5e0fea6e4f7b96c60767aaa0ada366d (diff)
downloadgo-tangerine-6ec13e7e2bab1ebdb580819a48629055bbbb5fb3.tar
go-tangerine-6ec13e7e2bab1ebdb580819a48629055bbbb5fb3.tar.gz
go-tangerine-6ec13e7e2bab1ebdb580819a48629055bbbb5fb3.tar.bz2
go-tangerine-6ec13e7e2bab1ebdb580819a48629055bbbb5fb3.tar.lz
go-tangerine-6ec13e7e2bab1ebdb580819a48629055bbbb5fb3.tar.xz
go-tangerine-6ec13e7e2bab1ebdb580819a48629055bbbb5fb3.tar.zst
go-tangerine-6ec13e7e2bab1ebdb580819a48629055bbbb5fb3.zip
Merge pull request #1701 from karalabe/eth62-sync-rebase
eth: implement eth/62 synchronization logic
Diffstat (limited to 'p2p')
-rw-r--r--p2p/metrics.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/p2p/metrics.go b/p2p/metrics.go
index f98cac274..98b61901d 100644
--- a/p2p/metrics.go
+++ b/p2p/metrics.go
@@ -38,8 +38,14 @@ type meteredConn struct {
}
// newMeteredConn creates a new metered connection, also bumping the ingress or
-// egress connection meter.
+// egress connection meter. If the metrics system is disabled, this function
+// returns the original object.
func newMeteredConn(conn net.Conn, ingress bool) net.Conn {
+ // Short circuit if metrics are disabled
+ if !metrics.Enabled {
+ return conn
+ }
+ // Otherwise bump the connection counters and wrap the connection
if ingress {
ingressConnectMeter.Mark(1)
} else {