Skip to content

Commit

Permalink
refactor: calculate seedratio by torrent size
Browse files Browse the repository at this point in the history
Fixes #276.

Previously was calculated by number of bytes downloaded, which caused
edge cases when those two numbers were not the same, e.g. if the user
already had part of the torrent from another source and only downloaded
a small part. When this happened, the ratio could be very large and use
of seedratio would behave in a way that most people would not expect.

Note, the old behavior has been around for a VERY LONG TIME. Even though
this is a bugfix, it does change semantics. I don't think there is any
third-party code that depends on the old behavior but this is arguably
a breaking change.
  • Loading branch information
ckerr committed Jan 17, 2022
1 parent 970a584 commit 311f5d7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libtransmission/utils.h
Expand Up @@ -388,7 +388,7 @@ std::string& tr_strvUtf8Clean(std::string_view cleanme, std::string& setme);
****
***/

/** @brief return TR_RATIO_NA or a number in [0..1]
/** @brief return TR_RATIO_NA, TR_RATIO_INF, or a number in [0..1]
@return TR_RATIO_NA, TR_RATIO_INF, or a number in [0..1] */
double tr_getRatio(uint64_t numerator, uint64_t denominator);

Expand Down

0 comments on commit 311f5d7

Please sign in to comment.