Don't assign result from atomic.AddUint64.
This commit is contained in:
parent
75b59ef6e4
commit
c51df0ca3c
1 changed files with 4 additions and 7 deletions
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)
|
n, msg, buf, err := btcwire.ReadMessageN(p.conn, p.protocolVersion, p.btcnet)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
p.bytesReceived += uint64(n)
|
p.bytesReceived += uint64(n)
|
||||||
p.server.bytesReceived = atomic.AddUint64(&p.server.bytesReceived,
|
atomic.AddUint64(&p.server.bytesReceived, uint64(n))
|
||||||
uint64(n))
|
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
p.bytesReceived += uint64(n)
|
p.bytesReceived += uint64(n)
|
||||||
p.server.bytesReceived = atomic.AddUint64(&p.server.bytesReceived,
|
atomic.AddUint64(&p.server.bytesReceived, uint64(n))
|
||||||
uint64(n))
|
|
||||||
|
|
||||||
// Use closures to log expensive operations so they are only run when
|
// Use closures to log expensive operations so they are only run when
|
||||||
// the logging level requires it.
|
// 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)
|
n, err := btcwire.WriteMessageN(p.conn, msg, p.protocolVersion, p.btcnet)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
p.bytesSent += uint64(n)
|
p.bytesSent += uint64(n)
|
||||||
p.server.bytesSent = atomic.AddUint64(&p.server.bytesSent,
|
atomic.AddUint64(&p.server.bytesSent, uint64(n))
|
||||||
uint64(n))
|
|
||||||
p.Disconnect()
|
p.Disconnect()
|
||||||
p.logError("Can't send message: %v", err)
|
p.logError("Can't send message: %v", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
p.bytesSent += uint64(n)
|
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
|
// isAllowedByRegression returns whether or not the passed error is allowed by
|
||||||
|
|
Loading…
Add table
Reference in a new issue