Class StartStopRulesDefaultPlugin

  • All Implemented Interfaces:
    COConfigurationListener, AEDiagnosticsEvidenceGenerator, Plugin

    public class StartStopRulesDefaultPlugin
    extends java.lang.Object
    implements Plugin, COConfigurationListener, AEDiagnosticsEvidenceGenerator
    Handles Starting and Stopping of torrents. TODO: RANK_TIMED is quite a hack and is spread all over. It needs to be redone, probably with a timer on each seeding torrent which triggers when time is up and it needs to stop. BUG: When "AutoStart 0 Peers" is on, and minSpeedForActivelySeeding is enabled, the 0 peer torrents will continuously switch from seeding to queued, probably due to the connection attempt registering speed. This might be fixed by the "wait XX ms before switching active state" code. Other Notes: "CD" is often used to refer to "Seed" or "Seeding", because "C" sounds like "See"
    • Field Detail

      • RANK_NONE

        public static final int RANK_NONE
        Do not rank completed torrents
        See Also:
        Constant Field Values
      • RANK_SPRATIO

        public static final int RANK_SPRATIO
        Rank completed torrents using Seeds:Peer Ratio
        See Also:
        Constant Field Values
      • RANK_SEEDCOUNT

        public static final int RANK_SEEDCOUNT
        Rank completed torrents using Seed Count method
        See Also:
        Constant Field Values
      • RANK_TIMED

        public static final int RANK_TIMED
        Rank completed torrents using a timed rotation of minTimeAlive
        See Also:
        Constant Field Values
      • RANK_PEERCOUNT

        public static final int RANK_PEERCOUNT
        Rank completed torrents using the peers count, weighted by the seeds to peers ratio
        See Also:
        Constant Field Values
      • FORCE_CHECK_PERIOD

        private static final int FORCE_CHECK_PERIOD
        Force at least one check every period of time (in ms). Used in ChangeFlagCheckerTask
        See Also:
        Constant Field Values
      • CHECK_FOR_GROSS_CHANGE_PERIOD

        private static final int CHECK_FOR_GROSS_CHANGE_PERIOD
        Check for non triggerable changes ever period of time (in ms)
        See Also:
        Constant Field Values
      • MIN_SEEDING_STARTUP_WAIT

        private static final int MIN_SEEDING_STARTUP_WAIT
        Wait xx ms before starting completed torrents (so scrapes can come in)
        See Also:
        Constant Field Values
      • MIN_FIRST_SCRAPE_WAIT

        private static final int MIN_FIRST_SCRAPE_WAIT
        Wait at least xx ms for first scrape, before starting completed torrents
        See Also:
        Constant Field Values
      • IGNORE_SLOT_THRESHOLD_FACTOR

        private static final float IGNORE_SLOT_THRESHOLD_FACTOR
        See Also:
        Constant Field Values
      • MIN_DOWNLOADING_STARTUP_WAIT

        private static final int MIN_DOWNLOADING_STARTUP_WAIT
        See Also:
        Constant Field Values
      • tagsHaveDLLimits

        private volatile boolean tagsHaveDLLimits
      • globalDownloadSpeedAverage

        private Average globalDownloadSpeedAverage
      • rankCalculatorMap

        private static java.util.Map<java.lang.Object,​DefaultRankCalculator> rankCalculatorMap
        Map to relate downloadData to a Download OR reserved slot
      • sortedArrayCache

        private volatile DefaultRankCalculator[] sortedArrayCache
        this is used to reduce the number of comperator invocations by keeping a mostly sorted copy around, must be nulled whenever the map is changed
      • closingDown

        private volatile boolean closingDown
      • somethingChanged

        private volatile boolean somethingChanged
      • ranksToRecalc_mon

        private AEMonitor ranksToRecalc_mon
      • monoStartedOn

        private long monoStartedOn
        When rules class started. Used for initial waiting logic
      • bDebugLog

        protected boolean bDebugLog
        Whether Debug Info is written to the log and tooltip
      • iRankType

        private int iRankType
        Ranking System to use. One of RANK_* constants
      • minSpeedForActiveSeeding

        private int minSpeedForActiveSeeding
      • maxStalledSeeding

        private int maxStalledSeeding
        Maximimum # of stalled torrents that are in seeding mode
      • maxOverLimitSeeding

        private int maxOverLimitSeeding
      • stalledSeedingIgnoreZP

        private boolean stalledSeedingIgnoreZP
      • _maxActive

        private int _maxActive
      • _maxActiveWhenSeedingEnabled

        private boolean _maxActiveWhenSeedingEnabled
      • _maxActiveWhenSeeding

        private int _maxActiveWhenSeeding
      • globalDownloadLimit

        private int globalDownloadLimit
      • globalUploadLimit

        private int globalUploadLimit
      • globalUploadWhenSeedingLimit

        private int globalUploadWhenSeedingLimit
      • maxConfiguredDownloads

        private int maxConfiguredDownloads
      • bMaxDownloadIgnoreChecking

        private boolean bMaxDownloadIgnoreChecking
      • minDownloads

        private int minDownloads
      • bAutoReposition

        private boolean bAutoReposition
      • minTimeAlive

        private long minTimeAlive
      • bAutoStart0Peers

        private boolean bAutoStart0Peers
      • bStopOnceBandwidthMet

        private boolean bStopOnceBandwidthMet
      • bStartNoMoreSeedsWhenUpLimitMet

        private boolean bStartNoMoreSeedsWhenUpLimitMet
      • bStartNoMoreSeedsWhenUpLimitMetPercent

        private boolean bStartNoMoreSeedsWhenUpLimitMetPercent
      • bStartNoMoreSeedsWhenUpLimitMetSlack

        private int bStartNoMoreSeedsWhenUpLimitMetSlack
      • iDownloadSortType

        private int iDownloadSortType
      • iDownloadTestTimeMillis

        private int iDownloadTestTimeMillis
      • iDownloadReTestMillis

        private int iDownloadReTestMillis
      • bDownloadTestActive

        private boolean bDownloadTestActive
      • bTagFirstPriority

        private boolean bTagFirstPriority
      • bAlreadyInitialized

        private static boolean bAlreadyInitialized
      • pauseChangeFlagChecker

        public static boolean pauseChangeFlagChecker
      • fp_tag

        private Tag fp_tag
      • numReservedSeedingSlots

        private volatile int numReservedSeedingSlots
      • slotStatus

        private java.lang.String slotStatus
      • immediateProcessingScheduled

        private volatile boolean immediateProcessingScheduled
      • changeCheckCount

        private long changeCheckCount
      • changeCheckTotalMS

        private long changeCheckTotalMS
      • changeCheckMaxMS

        private long changeCheckMaxMS
      • processCount

        private long processCount
      • processTotalMS

        private long processTotalMS
      • processMaxMS

        private long processMaxMS
      • processLastComplete

        private long processLastComplete
      • processTotalGap

        private long processTotalGap
      • processTotalRecalcs

        private long processTotalRecalcs
      • processTotalZeroRecalcs

        private long processTotalZeroRecalcs
      • dlr_max_rate_time

        private long dlr_max_rate_time
      • processMergeCount

        private long processMergeCount
        Request that the startstop rules process. Used when it's known that something has changed that will effect torrent's state/position/rank.
    • Constructor Detail

      • StartStopRulesDefaultPlugin

        public StartStopRulesDefaultPlugin()