mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 10:22:23 +00:00
p2p: use the metered variable in the condition
This commit is contained in:
parent
269e16945c
commit
fe18aa2400
1 changed files with 3 additions and 3 deletions
|
|
@ -93,7 +93,7 @@ type meteredConn struct {
|
|||
connected time.Time // Connection time of the peer
|
||||
ip net.IP // IP address of the peer
|
||||
id string // NodeID of the peer
|
||||
metered bool // Used when the connection is closed to check if the peer was metered
|
||||
metered bool // Checks if the peer is metered
|
||||
ingressMeter metrics.Meter // Meter for the read bytes of the peer
|
||||
egressMeter metrics.Meter // Meter for the written bytes of the peer
|
||||
|
||||
|
|
@ -132,7 +132,7 @@ func (c *meteredConn) Read(b []byte) (n int, err error) {
|
|||
n, err = c.Conn.Read(b)
|
||||
ingressTrafficMeter.Mark(int64(n))
|
||||
c.lock.RLock()
|
||||
if c.ingressMeter != nil {
|
||||
if c.metered {
|
||||
c.ingressMeter.Mark(int64(n))
|
||||
}
|
||||
c.lock.RUnlock()
|
||||
|
|
@ -145,7 +145,7 @@ func (c *meteredConn) Write(b []byte) (n int, err error) {
|
|||
n, err = c.Conn.Write(b)
|
||||
egressTrafficMeter.Mark(int64(n))
|
||||
c.lock.RLock()
|
||||
if c.egressMeter != nil {
|
||||
if c.metered {
|
||||
c.egressMeter.Mark(int64(n))
|
||||
}
|
||||
c.lock.RUnlock()
|
||||
|
|
|
|||
Loading…
Reference in a new issue