Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: harden idle_seconds #6834

Merged
merged 2 commits into from
Jun 1, 2024
Merged

Conversation

Coeur
Copy link
Collaborator

@Coeur Coeur commented May 8, 2024

That change wouldn't fix the root cause of #6833, but it would avoid further issues in release by preventing returning a negative idle_seconds.

I see for instance that we read date_active_ from a resume file, so that could be a scenario where date_active_ is above now. Or the system clock was modified.

Copy link
Member

@ckerr ckerr left a comment

Choose a reason for hiding this comment

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

I'm not sure that I like this.

  • It doesn't quite make sense for queue_stalled_minutes_ to be a time_t.
  • It assumes that time_t is signed, which is arguably true for POSIX and definitely true for GNU, but isn't guaranteed in the C spec AFAICT
  • The change seems to be prompted by an invalid assumption in the assertion now >= latest. Maybe idle_seconds should return now > latest ? now - latest : 0?

@Coeur
Copy link
Collaborator Author

Coeur commented Jun 1, 2024

@ckerr 56469da

@ckerr ckerr changed the title Hardening idle_seconds refactor: harden idle_seconds Jun 1, 2024
@ckerr ckerr added scope:core type:refactor A code change that neither fixes a bug nor adds a feature notes:none Should not be listed in release notes labels Jun 1, 2024
@ckerr ckerr merged commit acee39e into transmission:main Jun 1, 2024
25 checks passed
@Coeur Coeur deleted the coeur/idle_seconds branch June 3, 2024 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
notes:none Should not be listed in release notes scope:core type:refactor A code change that neither fixes a bug nor adds a feature
Development

Successfully merging this pull request may close these issues.

None yet

2 participants