Class NetworkManager
java.lang.Object
com.biglybt.core.networkmanager.NetworkManager
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceByte stream match filter for routing.static interfaceListener for routing events. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Corestatic final intstatic final intstatic final intprivate TransferProcessorprivate static longprivate static longprivate static longstatic booleanstatic booleanprivate static final NetworkManagerprivate TransferProcessorprivate static booleanprivate TransferProcessorprivate static longprivate static longprivate static longprivate static longprivate static longprivate static longstatic booleanprivate static final booleanprivate final List<ReadController> static booleanprivate static booleanprivate static booleanstatic final longprivate TransferProcessor(package private) static booleanprivate final List<WriteController> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddRateLimiter(NetworkConnectionBase peer_connection, LimitedRateGroup group, boolean upload) voidaddReadEntity(RateControlledEntity entity, int _partition_id) Add a download entity for read processing.voidaddWriteEntity(RateControlledEntity entity, int _partition_id) Add an upload entity for write processing.bindTransport(Transport transport, MessageStreamEncoder encoder, MessageStreamDecoder decoder) voidCancel a request for inbound connection routing.createConnection(ConnectionEndpoint target, MessageStreamEncoder encoder, MessageStreamDecoder decoder, boolean connect_with_crypto, boolean allow_fallback, byte[][] shared_secrets) Create a new unconnected remote network connection (for outbound-initiated connections).voiddowngradeTransferProcessing(NetworkConnectionBase peer_connection, int partition_id) Downgrade the given connection back to a normal-speed network transfer handling.static booleangetCryptoRequired(int override_level) static longstatic longstatic longstatic intgetRateHandler(boolean upload, boolean lan) getRateHandler(NetworkConnectionBase peer_connection, boolean upload) static NetworkManagerGet the singleton instance of the network manager.voidinitialize(Core _core) static booleanstatic boolean(package private) static voidvoidremoveRateLimiter(NetworkConnectionBase peer_connection, LimitedRateGroup group, boolean upload) booleanremoveReadEntity(RateControlledEntity entity, int _partition_id) Remove a download entity from read processing.booleanremoveWriteEntity(RateControlledEntity entity, int _partition_id) Remove an upload entity from write processing.voidrequestIncomingConnectionRouting(NetworkManager.ByteMatcher matcher, NetworkManager.RoutingListener listener, MessageStreamFactory factory) Request the acceptance and routing of new incoming connections that match the given initial byte sequence.voidstartTransferProcessing(NetworkConnectionBase peer_connection) Register peer connection for network upload and download handling.voidstopTransferProcessing(NetworkConnectionBase peer_connection, int partition_id) Cancel network upload and download handling for the given connection.voidupgradeTransferProcessing(NetworkConnectionBase peer_connection, int partition_id) Upgrade the given connection to high-speed network transfer handling.
-
Field Details
-
UNLIMITED_RATE
public static final long UNLIMITED_RATE- See Also:
-
PARTITION_BY_CONNECTION
private static final boolean PARTITION_BY_CONNECTION- See Also:
-
instance
-
external_max_download_rate_bps
private static long external_max_download_rate_bps -
external_max_upload_rate_bps_normal
private static long external_max_upload_rate_bps_normal -
external_max_upload_rate_bps_seeding_only
private static long external_max_upload_rate_bps_seeding_only -
max_download_rate_bps_adj
private static long max_download_rate_bps_adj -
max_upload_rate_bps_normal_adj
private static long max_upload_rate_bps_normal_adj -
max_upload_rate_bps_seeding_only_adj
private static long max_upload_rate_bps_seeding_only_adj -
max_upload_rate_bps_adj
private static long max_upload_rate_bps_adj -
lan_rate_enabled
private static boolean lan_rate_enabled -
max_lan_upload_rate_bps_adj
private static long max_lan_upload_rate_bps_adj -
max_lan_download_rate_bps_adj
private static long max_lan_download_rate_bps_adj -
seeding_only_mode_allowed
private static boolean seeding_only_mode_allowed -
seeding_only_mode
private static boolean seeding_only_mode -
REQUIRE_CRYPTO_HANDSHAKE
public static boolean REQUIRE_CRYPTO_HANDSHAKE -
INCOMING_HANDSHAKE_FALLBACK_ALLOWED
public static boolean INCOMING_HANDSHAKE_FALLBACK_ALLOWED -
OUTGOING_HANDSHAKE_FALLBACK_ALLOWED
public static boolean OUTGOING_HANDSHAKE_FALLBACK_ALLOWED -
INCOMING_CRYPTO_ALLOWED
public static boolean INCOMING_CRYPTO_ALLOWED -
USE_REQUEST_LIMITING
static boolean USE_REQUEST_LIMITING -
core
-
write_controllers
-
read_controllers
-
upload_processor
-
download_processor
-
lan_upload_processor
-
lan_download_processor
-
CRYPTO_OVERRIDE_NONE
public static final int CRYPTO_OVERRIDE_NONE- See Also:
-
CRYPTO_OVERRIDE_REQUIRED
public static final int CRYPTO_OVERRIDE_REQUIRED- See Also:
-
CRYPTO_OVERRIDE_NOT_REQUIRED
public static final int CRYPTO_OVERRIDE_NOT_REQUIRED- See Also:
-
-
Constructor Details
-
NetworkManager
private NetworkManager()
-
-
Method Details
-
getWriteControllers
-
isLANRateEnabled
public static boolean isLANRateEnabled() -
getMinMssSize
public static int getMinMssSize() -
refreshRates
static void refreshRates() -
isSeedingOnlyUploadRate
public static boolean isSeedingOnlyUploadRate() -
getMaxUploadRateBPSNormal
public static long getMaxUploadRateBPSNormal() -
getMaxUploadRateBPSSeedingOnly
public static long getMaxUploadRateBPSSeedingOnly() -
getMaxDownloadRateBPS
public static long getMaxDownloadRateBPS() -
getCryptoRequired
public static boolean getCryptoRequired(int override_level) -
initialize
-
getSingleton
Get the singleton instance of the network manager.- Returns:
- the network manager
-
createConnection
public NetworkConnection createConnection(ConnectionEndpoint target, MessageStreamEncoder encoder, MessageStreamDecoder decoder, boolean connect_with_crypto, boolean allow_fallback, byte[][] shared_secrets) Create a new unconnected remote network connection (for outbound-initiated connections).- Parameters:
encoder- default message stream encoder to use for the outgoing queuedecoder- default message stream decoder to use for the incoming queueremote_address- to connect to- Returns:
- a new connection
-
requestIncomingConnectionRouting
public void requestIncomingConnectionRouting(NetworkManager.ByteMatcher matcher, NetworkManager.RoutingListener listener, MessageStreamFactory factory) Request the acceptance and routing of new incoming connections that match the given initial byte sequence.- Parameters:
matcher- initial byte sequence used for routinglistener- for handling new inbound connectionsfactory- to use for creating default stream encoder/decoders
-
bindTransport
public NetworkConnection bindTransport(Transport transport, MessageStreamEncoder encoder, MessageStreamDecoder decoder) -
cancelIncomingConnectionRouting
Cancel a request for inbound connection routing.- Parameters:
matcher- byte sequence originally used to register
-
addWriteEntity
Add an upload entity for write processing.- Parameters:
entity- to add
-
removeWriteEntity
Remove an upload entity from write processing.- Parameters:
entity- to remove
-
addReadEntity
Add a download entity for read processing.- Parameters:
entity- to add
-
removeReadEntity
Remove a download entity from read processing.- Parameters:
entity- to remove
-
getConnections
-
startTransferProcessing
Register peer connection for network upload and download handling. NOTE: The given max rate limits are ignored until the connection is upgraded. NOTE: The given max rate limits are ignored for LANLocal connections.- Parameters:
peer_connection- to register for network transfer processingupload_group- upload rate limit groupdownload_group- download rate limit group
-
stopTransferProcessing
Cancel network upload and download handling for the given connection.- Parameters:
peer_connection- to cancel
-
upgradeTransferProcessing
Upgrade the given connection to high-speed network transfer handling.- Parameters:
peer_connection- to upgrade
-
downgradeTransferProcessing
Downgrade the given connection back to a normal-speed network transfer handling.- Parameters:
peer_connection- to downgrade
-
getUploadProcessor
-
addRateLimiter
public void addRateLimiter(NetworkConnectionBase peer_connection, LimitedRateGroup group, boolean upload) -
removeRateLimiter
public void removeRateLimiter(NetworkConnectionBase peer_connection, LimitedRateGroup group, boolean upload) -
getRateHandler
-
getRateHandler
-