Don't assign result from atomic.AddUint64.

This commit is contained in:
Dave Collins 2014-02-05 11:43:37 -06:00
parent 75b59ef6e4
commit c51df0ca3c

11
peer.go
View File

@ -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