R-1292: qBittorrent's 50 % rule owns the NORMAL limit only (up_limit through app/preferences), never the current speed mode's slot. Test with the alternative mode on, red-proved. Commit only.
gates / gates (push) Successful in 1m32s
gates / gates (push) Successful in 1m32s
This commit is contained in:
1 parent
3d711ee611
commit
26191911c4
7 files changed
+107
-8
No files matched your search
@@ -34,10 +34,13 @@ type QBLimitState struct {
|
||||
HouseholdAt string `json:"household_at,omitempty"`
|
||||
}
|
||||
|
||||
// QBLimiter is the qBittorrent side the rule needs (the QBittorrent explainer satisfies it).
|
||||
// QBLimiter is the qBittorrent side the rule needs (the QBittorrent explainer satisfies it). R-1292: the rule owns the
|
||||
// NORMAL slot only (`up_limit` through app/preferences) — `transfer/uploadLimit`/`setUploadLimit` act on the CURRENT
|
||||
// speed mode's slot (measured on 5.2.4), so with the household's alternative speed on the rule used to set the
|
||||
// alternative limit, and the next switch read as „the household changed it". Never the alternative slot.
|
||||
type QBLimiter interface {
|
||||
UploadLimit(ctx context.Context, h map[string]string) (int64, error)
|
||||
SetUploadLimit(ctx context.Context, bytesPerSec int64) (int64, error)
|
||||
NormalLimit(ctx context.Context) (int64, error)
|
||||
SetNormalLimit(ctx context.Context, bytesPerSec int64) (int64, error)
|
||||
}
|
||||
|
||||
// QBLimitTarget is share × line, in bytes/s.
|
||||
@@ -51,7 +54,7 @@ func ApplyQBLimit(ctx context.Context, q QBLimiter, st QBLimitState, lineMbps fl
|
||||
if st.Household {
|
||||
return st, "household", nil
|
||||
}
|
||||
cur, err := q.UploadLimit(ctx, nil)
|
||||
cur, err := q.NormalLimit(ctx)
|
||||
if err != nil {
|
||||
return st, "error", err
|
||||
}
|
||||
@@ -69,7 +72,7 @@ func ApplyQBLimit(ctx context.Context, q QBLimiter, st QBLimitState, lineMbps fl
|
||||
if !lineKnown {
|
||||
return st, "no-line", nil
|
||||
}
|
||||
stored, err := q.SetUploadLimit(ctx, QBLimitTarget(lineMbps, share))
|
||||
stored, err := q.SetNormalLimit(ctx, QBLimitTarget(lineMbps, share))
|
||||
if err != nil {
|
||||
return st, "error", err
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user