TrackerBackoff

The exponential failure back-off libtorrent applies between failed announces, ported from announce_infohash::failed (src/announce_entry.cpp). Exposed as a pure helper so the session's announce loop can compute the next-announce instant without duplicating the formula. The loop owns when to call it; this just does the arithmetic.

Properties

Link copied to clipboard
const val DEFAULT_BACKOFF_RATIO: Int = 250

libtorrent settings_pack::tracker_backoff default of 250 (percent).

Link copied to clipboard
const val MAX_DELAY_SECS: Int

libtorrent tracker_retry_delay_max: never wait more than 60 minutes.

Link copied to clipboard
const val MIN_DELAY_SECS: Int = 5

libtorrent tracker_retry_delay_min: never retry sooner than 5 seconds.

Functions

Link copied to clipboard
fun nextDelaySecs(fails: Int, backoffRatio: Int = DEFAULT_BACKOFF_RATIO, retryIntervalSecs: Int = 0): Long

The seconds to wait before the next announce after fails consecutive failures, porting libtorrent's max(retry_interval, min(tracker_retry_delay_max, tracker_retry_delay_min + fails² * tracker_retry_delay_min * backoff_ratio / 100)).