mirror of
https://github.com/btcsuite/btcd.git
synced 2024-11-19 09:50:08 +01:00
Don't assign result from atomic.AddUint64.
This commit is contained in:
parent
75b59ef6e4
commit
c51df0ca3c
11
peer.go
11
peer.go
@ -957,13 +957,11 @@ func (p *peer) readMessage() (btcwire.Message, []byte, error) {
|
||||
n, msg, buf, err := btcwire.ReadMessageN(p.conn, p.protocolVersion, p.btcnet)
|
||||
if err != nil {
|
||||
p.bytesReceived += uint64(n)
|
||||
p.server.bytesReceived = atomic.AddUint64(&p.server.bytesReceived,
|
||||
uint64(n))
|
||||
atomic.AddUint64(&p.server.bytesReceived, uint64(n))
|
||||
return nil, nil, err
|
||||
}
|
||||
p.bytesReceived += uint64(n)
|
||||
p.server.bytesReceived = atomic.AddUint64(&p.server.bytesReceived,
|
||||
uint64(n))
|
||||
atomic.AddUint64(&p.server.bytesReceived, uint64(n))
|
||||
|
||||
// Use closures to log expensive operations so they are only run when
|
||||
// the logging level requires it.
|
||||
@ -1030,14 +1028,13 @@ func (p *peer) writeMessage(msg btcwire.Message) {
|
||||
n, err := btcwire.WriteMessageN(p.conn, msg, p.protocolVersion, p.btcnet)
|
||||
if err != nil {
|
||||
p.bytesSent += uint64(n)
|
||||
p.server.bytesSent = atomic.AddUint64(&p.server.bytesSent,
|
||||
uint64(n))
|
||||
atomic.AddUint64(&p.server.bytesSent, uint64(n))
|
||||
p.Disconnect()
|
||||
p.logError("Can't send message: %v", err)
|
||||
return
|
||||
}
|
||||
p.bytesSent += uint64(n)
|
||||
p.server.bytesSent = atomic.AddUint64(&p.server.bytesSent, uint64(n))
|
||||
atomic.AddUint64(&p.server.bytesSent, uint64(n))
|
||||
}
|
||||
|
||||
// isAllowedByRegression returns whether or not the passed error is allowed by
|
||||
|
Loading…
Reference in New Issue
Block a user