mirror of https://github.com/minio/minio.git
Fix TrafficMeter data race (#13041)
When reading `TrafficMeter` values, there was a value receiver. This means that receivers are copied unsafely when invoked. Fixes race seen with `-race` build.
This commit is contained in:
parent
7fb9301c03
commit
8315bcd0d8
|
@ -38,7 +38,7 @@ func (r *IncomingTrafficMeter) Read(p []byte) (n int, err error) {
|
|||
}
|
||||
|
||||
// BytesCount returns the number of transferred bytes
|
||||
func (r IncomingTrafficMeter) BytesCount() int64 {
|
||||
func (r *IncomingTrafficMeter) BytesCount() int64 {
|
||||
return atomic.LoadInt64(&r.countBytes)
|
||||
}
|
||||
|
||||
|
@ -62,6 +62,6 @@ func (w *OutgoingTrafficMeter) Flush() {
|
|||
}
|
||||
|
||||
// BytesCount returns the number of transferred bytes
|
||||
func (w OutgoingTrafficMeter) BytesCount() int64 {
|
||||
func (w *OutgoingTrafficMeter) BytesCount() int64 {
|
||||
return atomic.LoadInt64(&w.countBytes)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue