forked from TrueCloudLab/rclone
accounting: fix --bwlimit when up or down is off - fixes #5019
Before this change the core bandwidth limit was limited to upload or download value if the other value was off. This fix only applies a core bandwidth limit when both values are set.
This commit is contained in:
parent
e779cacc82
commit
2aebeb6061
1 changed files with 2 additions and 1 deletions
|
@ -68,7 +68,8 @@ func newTokenBucket(bandwidth fs.BwPair) (tbs buckets) {
|
||||||
bandwidthAccounting = bandwidth.Rx
|
bandwidthAccounting = bandwidth.Rx
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if bandwidthAccounting > 0 {
|
// Limit core bandwidth to max of Rx and Tx if both are limited
|
||||||
|
if bandwidth.Tx > 0 && bandwidth.Rx > 0 {
|
||||||
tbs[TokenBucketSlotAccounting] = rate.NewLimiter(rate.Limit(bandwidthAccounting), maxBurstSize)
|
tbs[TokenBucketSlotAccounting] = rate.NewLimiter(rate.Limit(bandwidthAccounting), maxBurstSize)
|
||||||
}
|
}
|
||||||
for _, tb := range tbs {
|
for _, tb := range tbs {
|
||||||
|
|
Loading…
Add table
Reference in a new issue