eth, metrics, p2p: prepare metrics and net packets to eth/62
This commit is contained in:
@ -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 {
|
||||
|
Reference in New Issue
Block a user