aboutsummaryrefslogtreecommitdiffstats
path: root/p2p/metrics.go
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2015-08-20 04:50:54 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2015-08-20 04:50:54 +0800
commite2d44814a513e7a964797b1e3639343e6682a615 (patch)
tree8320092e4b9660e45cdfbcd284f6f841e3696b2d /p2p/metrics.go
parentbd3a44cac9664ff72584fb123b3348f24c62d066 (diff)
parent269c5c71072f9e17e6387f853d626bff1160db5c (diff)
downloaddexon-e2d44814a513e7a964797b1e3639343e6682a615.tar
dexon-e2d44814a513e7a964797b1e3639343e6682a615.tar.gz
dexon-e2d44814a513e7a964797b1e3639343e6682a615.tar.bz2
dexon-e2d44814a513e7a964797b1e3639343e6682a615.tar.lz
dexon-e2d44814a513e7a964797b1e3639343e6682a615.tar.xz
dexon-e2d44814a513e7a964797b1e3639343e6682a615.tar.zst
dexon-e2d44814a513e7a964797b1e3639343e6682a615.zip
Merge pull request #1694 from obscuren/hide-fdtrack
fdtrack: hide message
Diffstat (limited to 'p2p/metrics.go')
-rw-r--r--p2p/metrics.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/p2p/metrics.go b/p2p/metrics.go
index 8ee4ed04b..f98cac274 100644
--- a/p2p/metrics.go
+++ b/p2p/metrics.go
@@ -34,7 +34,7 @@ var (
// meteredConn is a wrapper around a network TCP connection that meters both the
// inbound and outbound network traffic.
type meteredConn struct {
- net.Conn
+ *net.TCPConn // Network connection to wrap with metering
}
// newMeteredConn creates a new metered connection, also bumping the ingress or
@@ -45,13 +45,13 @@ func newMeteredConn(conn net.Conn, ingress bool) net.Conn {
} else {
egressConnectMeter.Mark(1)
}
- return &meteredConn{conn}
+ return &meteredConn{conn.(*net.TCPConn)}
}
// Read delegates a network read to the underlying connection, bumping the ingress
// traffic meter along the way.
func (c *meteredConn) Read(b []byte) (n int, err error) {
- n, err = c.Conn.Read(b)
+ n, err = c.TCPConn.Read(b)
ingressTrafficMeter.Mark(int64(n))
return
}
@@ -59,7 +59,7 @@ func (c *meteredConn) Read(b []byte) (n int, err error) {
// Write delegates a network write to the underlying connection, bumping the
// egress traffic meter along the way.
func (c *meteredConn) Write(b []byte) (n int, err error) {
- n, err = c.Conn.Write(b)
+ n, err = c.TCPConn.Write(b)
egressTrafficMeter.Mark(int64(n))
return
}