Skip to content

Update share limits timer when share limits change #24670

Open
Kononkov1998 wants to merge 1 commit into
qbittorrent:masterfrom
Kononkov1998:fix-share-limits-timer
Open

Update share limits timer when share limits change #24670
Kononkov1998 wants to merge 1 commit into
qbittorrent:masterfrom
Kononkov1998:fix-share-limits-timer

Conversation

@Kononkov1998

@Kononkov1998 Kononkov1998 commented Jul 10, 2026

Copy link
Copy Markdown

Share limits are enforced by a periodic timer whose state is managed by updateShareLimitsTimer(). Changes to category and global share limits do not always update the timer state. Consequently, enabling a limit while the timer is stopped may leave it unenforced until another event starts the timer, such as restarting qBittorrent or adding a torrent with active effective share limits.

  • Category share limits: the timer state is not updated when categories are added, edited, or removed. Configured category limits are also only detected indirectly through the effective limits of existing torrents. Reproduction: with no global or per-torrent limits enabled, set a ratio limit on the category of a seeding torrent that has already exceeded it. The torrent continues seeding because the timer remains stopped.

  • Global share limits: setShareLimits() changes the global limits without updating the timer state. Before Refactor torrent share limits #24029 each global share limit setter updated the timer; this was lost when they were merged into setShareLimits(). Reproduction: with the timer stopped, enable a global ratio limit that a seeding torrent has already exceeded. The torrent continues seeding until another event starts the timer.

This change updates the timer state after global share limits, category options, or a torrent's category change. The first issue also exists in released 5.2.x versions.

Comment thread src/base/bittorrent/sessionimpl.cpp Outdated
@glassez glassez self-assigned this Jul 12, 2026
@glassez glassez added this to the 5.3 milestone Jul 12, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Ensures the share-limits enforcement timer (updateShareLimitsTimer()) is re-evaluated whenever global or category-based share limit settings change, preventing newly-enabled limits from remaining unenforced until a later unrelated event restarts the timer.

Changes:

  • Recompute the share-limits timer state after updating a category’s options.
  • Recompute the share-limits timer state after updating global share limits via setShareLimits().
  • Recompute the share-limits timer state when a torrent’s category changes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@glassez
glassez requested a review from a team July 15, 2026 11:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants