Class SpeedManagerImpl
- java.lang.Object
-
- com.biglybt.core.speedmanager.impl.SpeedManagerImpl
-
- All Implemented Interfaces:
SpeedManagerAlgorithmProviderAdapter
,SpeedManager
,AEDiagnosticsEvidenceGenerator
public class SpeedManagerImpl extends java.lang.Object implements SpeedManager, SpeedManagerAlgorithmProviderAdapter, AEDiagnosticsEvidenceGenerator
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
SpeedManagerImpl.nullProvider
protected static class
SpeedManagerImpl.pingContact
-
Field Summary
Fields Modifier and Type Field Description (package private) SpeedManagerAdapter
adapter
private java.lang.String
asn
private static int
AUTO_ADJUST_PERIOD_SECS
private static int
AUTO_ADJUST_PERIOD_TICKS
private static java.lang.String
CONFIG_AVAIL
private static java.lang.String
CONFIG_DEBUG
private static java.lang.String[]
CONFIG_PARAMS
static java.lang.String
CONFIG_VERSION
static java.lang.String
CONFIG_VERSION_STR
private static int
CONTACT_NUMBER
private static int
CONTACT_PING_SECS
(package private) java.util.Map
contacts
private SpeedManagerImpl.pingContact[]
contacts_array
(package private) Core
core
private static boolean
DEBUG
(package private) AsyncDispatcher
dispatcher
private static boolean
emulated_ping_source
private boolean
enabled
private CopyOnWriteList
listeners
private AEDiagnosticsLogger
logger
private static int
LONG_PERIOD_SECS
private static int
LONG_PERIOD_TICKS
(package private) static int
MEDIUM_ESTIMATE_SAMPLES
private static int
MEDIUM_ESTIMATE_SECS
private java.lang.Object
original_limits
(package private) SpeedManagerPingMapperImpl
ping_mapper
(package private) SpeedManagerPingMapperImpl[]
ping_mappers
private static boolean
pm_enabled
private SpeedManagerAlgorithmProvider
provider
private int
provider_version
private static int
SAVE_PERIOD_SECS
private static int
SAVE_PERIOD_TICKS
(package private) static int
SHORT_ESTIMATE_SAMPLES
private static int
SHORT_ESTIMATE_SECS
private static int
SPEED_AVERAGE_PERIOD
private DHTSpeedTester
speed_tester
private int
total_contacts
private CopyOnWriteList
transient_mappers
protected static int
UPDATE_PERIOD_MILLIS
-
Constructor Summary
Constructors Constructor Description SpeedManagerImpl(Core _core, SpeedManagerAdapter _adapter)
-
Method Summary
-
-
-
Field Detail
-
UPDATE_PERIOD_MILLIS
protected static final int UPDATE_PERIOD_MILLIS
- See Also:
- Constant Field Values
-
CONTACT_NUMBER
private static final int CONTACT_NUMBER
- See Also:
- Constant Field Values
-
CONTACT_PING_SECS
private static final int CONTACT_PING_SECS
- See Also:
- Constant Field Values
-
LONG_PERIOD_SECS
private static final int LONG_PERIOD_SECS
- See Also:
- Constant Field Values
-
LONG_PERIOD_TICKS
private static final int LONG_PERIOD_TICKS
- See Also:
- Constant Field Values
-
SHORT_ESTIMATE_SECS
private static final int SHORT_ESTIMATE_SECS
- See Also:
- Constant Field Values
-
MEDIUM_ESTIMATE_SECS
private static final int MEDIUM_ESTIMATE_SECS
- See Also:
- Constant Field Values
-
SHORT_ESTIMATE_SAMPLES
static final int SHORT_ESTIMATE_SAMPLES
- See Also:
- Constant Field Values
-
MEDIUM_ESTIMATE_SAMPLES
static final int MEDIUM_ESTIMATE_SAMPLES
- See Also:
- Constant Field Values
-
SAVE_PERIOD_SECS
private static final int SAVE_PERIOD_SECS
- See Also:
- Constant Field Values
-
SAVE_PERIOD_TICKS
private static final int SAVE_PERIOD_TICKS
- See Also:
- Constant Field Values
-
AUTO_ADJUST_PERIOD_SECS
private static final int AUTO_ADJUST_PERIOD_SECS
- See Also:
- Constant Field Values
-
AUTO_ADJUST_PERIOD_TICKS
private static final int AUTO_ADJUST_PERIOD_TICKS
- See Also:
- Constant Field Values
-
SPEED_AVERAGE_PERIOD
private static final int SPEED_AVERAGE_PERIOD
- See Also:
- Constant Field Values
-
DEBUG
private static boolean DEBUG
-
CONFIG_VERSION_STR
public static final java.lang.String CONFIG_VERSION_STR
- See Also:
- Constant Field Values
-
CONFIG_VERSION
public static final java.lang.String CONFIG_VERSION
- See Also:
- Constant Field Values
-
CONFIG_AVAIL
private static final java.lang.String CONFIG_AVAIL
- See Also:
- Constant Field Values
-
CONFIG_DEBUG
private static final java.lang.String CONFIG_DEBUG
- See Also:
- Constant Field Values
-
CONFIG_PARAMS
private static final java.lang.String[] CONFIG_PARAMS
-
emulated_ping_source
private static boolean emulated_ping_source
-
core
final Core core
-
speed_tester
private DHTSpeedTester speed_tester
-
adapter
final SpeedManagerAdapter adapter
-
provider
private SpeedManagerAlgorithmProvider provider
-
provider_version
private int provider_version
-
enabled
private boolean enabled
-
pm_enabled
private static final boolean pm_enabled
- See Also:
- Constant Field Values
-
contacts
final java.util.Map contacts
-
total_contacts
private volatile int total_contacts
-
contacts_array
private SpeedManagerImpl.pingContact[] contacts_array
-
original_limits
private java.lang.Object original_limits
-
dispatcher
final AsyncDispatcher dispatcher
-
ping_mapper
final SpeedManagerPingMapperImpl ping_mapper
-
ping_mappers
final SpeedManagerPingMapperImpl[] ping_mappers
-
transient_mappers
private final CopyOnWriteList transient_mappers
-
logger
private final AEDiagnosticsLogger logger
-
asn
private java.lang.String asn
-
listeners
private final CopyOnWriteList listeners
-
-
Constructor Detail
-
SpeedManagerImpl
public SpeedManagerImpl(Core _core, SpeedManagerAdapter _adapter)
-
-
Method Detail
-
getSpeedManager
public SpeedManager getSpeedManager()
- Specified by:
getSpeedManager
in interfaceSpeedManagerAlgorithmProviderAdapter
-
getASN
public java.lang.String getASN()
- Specified by:
getASN
in interfaceSpeedManager
-
getEstimatedUploadCapacityBytesPerSec
public SpeedManagerLimitEstimate getEstimatedUploadCapacityBytesPerSec()
- Specified by:
getEstimatedUploadCapacityBytesPerSec
in interfaceSpeedManager
-
setEstimatedUploadCapacityBytesPerSec
public void setEstimatedUploadCapacityBytesPerSec(int bytes_per_sec, float metric)
- Specified by:
setEstimatedUploadCapacityBytesPerSec
in interfaceSpeedManager
-
getEstimatedDownloadCapacityBytesPerSec
public SpeedManagerLimitEstimate getEstimatedDownloadCapacityBytesPerSec()
- Specified by:
getEstimatedDownloadCapacityBytesPerSec
in interfaceSpeedManager
-
setEstimatedDownloadCapacityBytesPerSec
public void setEstimatedDownloadCapacityBytesPerSec(int bytes_per_sec, float metric)
- Specified by:
setEstimatedDownloadCapacityBytesPerSec
in interfaceSpeedManager
-
reset
public void reset()
- Specified by:
reset
in interfaceSpeedManager
-
enableOrAlgChanged
protected void enableOrAlgChanged()
-
createTransientPingMapper
public SpeedManagerPingMapper createTransientPingMapper()
Description copied from interface:SpeedManagerAlgorithmProviderAdapter
Creates a mapper starting from current time. Must be destroyed by calling "destroy" when done with- Specified by:
createTransientPingMapper
in interfaceSpeedManagerAlgorithmProviderAdapter
- Returns:
-
destroy
protected void destroy(SpeedManagerPingMapper mapper)
-
setSpeedTester
public void setSpeedTester(DHTSpeedTester _tester)
- Specified by:
setSpeedTester
in interfaceSpeedManager
-
addPingHistory
protected void addPingHistory(int rtt, boolean re_base)
-
isAvailable
public boolean isAvailable()
- Specified by:
isAvailable
in interfaceSpeedManager
-
setEnabled
public void setEnabled(boolean _enabled)
- Specified by:
setEnabled
in interfaceSpeedManager
-
setEnabledSupport
protected void setEnabledSupport(boolean _enabled)
-
isEnabled
public boolean isEnabled()
- Specified by:
isEnabled
in interfaceSpeedManager
-
getSpeedTester
public DHTSpeedTester getSpeedTester()
- Specified by:
getSpeedTester
in interfaceSpeedManager
-
getPingSources
public SpeedManagerPingSource[] getPingSources()
- Specified by:
getPingSources
in interfaceSpeedManager
-
getActiveMapper
public SpeedManagerPingMapper getActiveMapper()
- Specified by:
getActiveMapper
in interfaceSpeedManager
-
getPingMapper
public SpeedManagerPingMapper getPingMapper()
- Specified by:
getPingMapper
in interfaceSpeedManagerAlgorithmProviderAdapter
-
getMappers
public SpeedManagerPingMapper[] getMappers()
- Specified by:
getMappers
in interfaceSpeedManager
-
getIdlePingMillis
public int getIdlePingMillis()
-
getCurrentPingMillis
public int getCurrentPingMillis()
-
getMaxPingMillis
public int getMaxPingMillis()
-
getCurrentChokeSpeed
public int getCurrentChokeSpeed()
Returns the current view of when choking occurs- Returns:
- speed in bytes/sec
-
getMaxUploadSpeed
public int getMaxUploadSpeed()
-
getCurrentUploadLimit
public int getCurrentUploadLimit()
- Specified by:
getCurrentUploadLimit
in interfaceSpeedManagerAlgorithmProviderAdapter
-
setCurrentUploadLimit
public void setCurrentUploadLimit(int bytes_per_second)
- Specified by:
setCurrentUploadLimit
in interfaceSpeedManagerAlgorithmProviderAdapter
-
getCurrentDownloadLimit
public int getCurrentDownloadLimit()
- Specified by:
getCurrentDownloadLimit
in interfaceSpeedManagerAlgorithmProviderAdapter
-
setCurrentDownloadLimit
public void setCurrentDownloadLimit(int bytes_per_second)
- Specified by:
setCurrentDownloadLimit
in interfaceSpeedManagerAlgorithmProviderAdapter
-
getCurrentProtocolUploadSpeed
public int getCurrentProtocolUploadSpeed()
- Specified by:
getCurrentProtocolUploadSpeed
in interfaceSpeedManagerAlgorithmProviderAdapter
-
getCurrentDataUploadSpeed
public int getCurrentDataUploadSpeed()
- Specified by:
getCurrentDataUploadSpeed
in interfaceSpeedManagerAlgorithmProviderAdapter
-
getCurrentDataDownloadSpeed
public int getCurrentDataDownloadSpeed()
- Specified by:
getCurrentDataDownloadSpeed
in interfaceSpeedManagerAlgorithmProviderAdapter
-
getCurrentProtocolDownloadSpeed
public int getCurrentProtocolDownloadSpeed()
- Specified by:
getCurrentProtocolDownloadSpeed
in interfaceSpeedManagerAlgorithmProviderAdapter
-
autoAdjust
private void autoAdjust()
-
setLoggingEnabled
public void setLoggingEnabled(boolean enabled)
-
log
public void log(java.lang.String str)
- Specified by:
log
in interfaceSpeedManagerAlgorithmProviderAdapter
-
informDownCapChanged
protected void informDownCapChanged()
-
informUpCapChanged
protected void informUpCapChanged()
-
informListeners
protected void informListeners(int type)
-
addListener
public void addListener(SpeedManagerListener l)
- Specified by:
addListener
in interfaceSpeedManager
-
removeListener
public void removeListener(SpeedManagerListener l)
- Specified by:
removeListener
in interfaceSpeedManager
-
generate
public void generate(IndentWriter writer)
- Specified by:
generate
in interfaceAEDiagnosticsEvidenceGenerator
-
-