Class NetworkAdminSpeedTestScheduledTestImpl
java.lang.Object
com.biglybt.core.networkmanager.admin.impl.NetworkAdminSpeedTestScheduledTestImpl
- All Implemented Interfaces:
NetworkAdminSpeedTestScheduledTest
public class NetworkAdminSpeedTestScheduledTestImpl
extends Object
implements NetworkAdminSpeedTestScheduledTest
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) class
Preservers the state of all the downloads before the speed test started. -
Field Summary
FieldsModifier and TypeFieldDescription(package private) boolean
private byte[]
private static final long
(package private) long
private String
private final CopyOnWriteList
(package private) long
(package private) final PluginInterface
private static final long
private static final long
(package private) TOTorrent
(package private) final NetworkAdminSpeedTesterImpl
private static final int
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
NetworkAdminSpeedTestScheduledTestImpl
(PluginInterface _plugin, NetworkAdminSpeedTesterImpl _tester) -
Method Summary
Modifier and TypeMethodDescriptionvoid
abort()
void
void
private Map
Read from URL and return byte array.long
long
These are the limits up to which the test can run, not the result of the testprivate String
getVersionFromJAR
(File jar_file) private Map
handleChallengeFromSpeedTestService
(File jar_file, Map result) void
protected void
protected void
reportStage
(String str) protected void
Restore all the downloads the state before the speed test started.private boolean
schedule()
Request a test from the speed testing service, handle the "challenge" if request and then get the id for the test.private Map
sendRequest
(Map request) (package private) void
protected void
Preserve all the data about the downloads while the test is running.boolean
start()
-
Field Details
-
REQUEST_TEST
private static final long REQUEST_TEST- See Also:
-
CHALLENGE_REPLY
private static final long CHALLENGE_REPLY- See Also:
-
TEST_RESULT
private static final long TEST_RESULT- See Also:
-
ZERO_DOWNLOAD_SETTING
private static final int ZERO_DOWNLOAD_SETTING- See Also:
-
plugin
-
tester
-
detectedRouter
-
preTestSettings
-
challenge_id
private byte[] challenge_id -
delay_millis
long delay_millis -
max_speed
long max_speed -
test_torrent
TOTorrent test_torrent -
aborted
volatile boolean aborted -
listeners
-
-
Constructor Details
-
NetworkAdminSpeedTestScheduledTestImpl
protected NetworkAdminSpeedTestScheduledTestImpl(PluginInterface _plugin, NetworkAdminSpeedTesterImpl _tester)
-
-
Method Details
-
getTester
- Specified by:
getTester
in interfaceNetworkAdminSpeedTestScheduledTest
-
getMaxUpBytePerSec
public long getMaxUpBytePerSec()Description copied from interface:NetworkAdminSpeedTestScheduledTest
These are the limits up to which the test can run, not the result of the test- Specified by:
getMaxUpBytePerSec
in interfaceNetworkAdminSpeedTestScheduledTest
- Returns:
-
getMaxDownBytePerSec
public long getMaxDownBytePerSec()- Specified by:
getMaxDownBytePerSec
in interfaceNetworkAdminSpeedTestScheduledTest
-
start
public boolean start()- Specified by:
start
in interfaceNetworkAdminSpeedTestScheduledTest
-
abort
public void abort()- Specified by:
abort
in interfaceNetworkAdminSpeedTestScheduledTest
-
abort
-
schedule
private boolean schedule()Request a test from the speed testing service, handle the "challenge" if request and then get the id for the test. Per spec all request are BEncoded maps.- Returns:
- boolean - true if the test has been reserved with the service.
-
getVersionFromJAR
-
handleChallengeFromSpeedTestService
- Parameters:
jar_file
- - File Azureus jar used to load classes.result
- - Map from the previous response- Returns:
- Map - from the current response.
- Throws:
IOException
-
sendResult
-
sendRequest
- Throws:
IOException
-
getBEncodedMapFromRequest
Read from URL and return byte array.- Parameters:
url
- -- Returns:
- byte[] of the results. Max size currently 100k.
- Throws:
IOException
- -
-
resetSpeedLimits
protected void resetSpeedLimits()Restore all the downloads the state before the speed test started. -
setSpeedLimits
protected void setSpeedLimits()Preserve all the data about the downloads while the test is running. -
reportStage
-
reportComplete
protected void reportComplete() -
addListener
- Specified by:
addListener
in interfaceNetworkAdminSpeedTestScheduledTest
-
removeListener
- Specified by:
removeListener
in interfaceNetworkAdminSpeedTestScheduledTest
-