diff options
author | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-08-04 18:51:16 +0800 |
---|---|---|
committer | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-08-04 18:51:16 +0800 |
commit | b01f2c29ae48dba0ba4a90a4c6dbbadfc313f5b1 (patch) | |
tree | 00ab530e6f28230400a65ebae7a4610f94cc1f80 /p2p/metrics.go | |
parent | ff66e8fa2935d59d5104e324861d9e1bb517ffaa (diff) | |
parent | 5c949d3b3ba81ea0563575b19a7b148aeac4bf61 (diff) | |
download | go-tangerine-b01f2c29ae48dba0ba4a90a4c6dbbadfc313f5b1.tar.gz go-tangerine-b01f2c29ae48dba0ba4a90a4c6dbbadfc313f5b1.tar.zst go-tangerine-b01f2c29ae48dba0ba4a90a4c6dbbadfc313f5b1.zip |
Merge pull request #1574 from fjl/fdtrack
fdtrack: hack to track file descriptor usage
Diffstat (limited to 'p2p/metrics.go')
-rw-r--r-- | p2p/metrics.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/p2p/metrics.go b/p2p/metrics.go index f98cac274..8ee4ed04b 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.TCPConn // Network connection to wrap with metering + net.Conn } // 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.(*net.TCPConn)} + return &meteredConn{conn} } // 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.TCPConn.Read(b) + n, err = c.Conn.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.TCPConn.Write(b) + n, err = c.Conn.Write(b) egressTrafficMeter.Mark(int64(n)) return } |