mirror of
https://github.com/minio/minio.git
synced 2025-11-07 21:02:58 -05:00
fix:(replication/bandwidth) add missing validation in monitored reader (#12582)
This commit is contained in:
committed by
GitHub
parent
36110fbc77
commit
c20fbcd842
@@ -41,11 +41,13 @@ type MonitorReaderOptions struct {
|
||||
|
||||
// Read implements a throttled read
|
||||
func (r *MonitoredReader) Read(buf []byte) (n int, err error) {
|
||||
if r.throttle == nil {
|
||||
return r.r.Read(buf)
|
||||
}
|
||||
if r.lastErr != nil {
|
||||
err = r.lastErr
|
||||
return
|
||||
}
|
||||
|
||||
b := r.throttle.Burst() // maximum available tokens
|
||||
need := len(buf) // number of bytes requested by caller
|
||||
hdr := r.opts.HeaderSize // remaining header bytes
|
||||
|
||||
Reference in New Issue
Block a user