Package com.biglybt.core.networkmanager
Interface NetworkConnection
-
- All Superinterfaces:
NetworkConnectionBase
- All Known Implementing Classes:
NetworkConnectionImpl
public interface NetworkConnection extends NetworkConnectionBase
Represents a managed network connection, over which messages can be sent and received.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
NetworkConnection.ConnectionListener
Listener for notification of connection events.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
close(java.lang.String reason)
Close and shutdown this connection.void
connect(int priority, NetworkConnection.ConnectionListener listener)
Connect this connection's transport, i.e.void
connect(java.nio.ByteBuffer initial_outbound_data, int priority, NetworkConnection.ConnectionListener listener)
Transport
detachTransport()
Decouples the transport from this network connection so it can be reusedvoid
enableEnhancedMessageProcessing(boolean enable, int partition_id)
Upgrade the connection to high-speed transfer processing.Transport
getTransport()
Get the connection's data transport interface.java.lang.Object
getUserData(java.lang.Object key)
boolean
isConnected()
java.lang.Object
setUserData(java.lang.Object key, java.lang.Object value)
void
startMessageProcessing()
Begin processing incoming and outgoing message queues.-
Methods inherited from interface com.biglybt.core.networkmanager.NetworkConnectionBase
addRateLimiter, getDownloadLimit, getEndpoint, getIncomingMessageQueue, getMssSize, getOutgoingMessageQueue, getRateLimiters, getString, getTransportBase, getUploadLimit, isClosed, isIncoming, isLANLocal, notifyOfException, removeRateLimiter, resetLANLocalStatus, setDownloadLimit, setUploadLimit
-
-
-
-
Method Detail
-
connect
void connect(int priority, NetworkConnection.ConnectionListener listener)
Connect this connection's transport, i.e. establish the network connection. If this connection is already established (from an incoming connection for example), then this provides a mechanism to register the connection listener, in which case connectSuccess() will be called immediately.- Parameters:
listener
- notified on connect success or failure
-
connect
void connect(java.nio.ByteBuffer initial_outbound_data, int priority, NetworkConnection.ConnectionListener listener)
-
close
void close(java.lang.String reason)
Close and shutdown this connection.
-
startMessageProcessing
void startMessageProcessing()
Begin processing incoming and outgoing message queues.- Parameters:
upload_group
- upload rate limit group to usedownload_group
- download rate limit group to use
-
enableEnhancedMessageProcessing
void enableEnhancedMessageProcessing(boolean enable, int partition_id)
Upgrade the connection to high-speed transfer processing.- Parameters:
enable
- true for high-speed processing, false for normal processing
-
detachTransport
Transport detachTransport()
Decouples the transport from this network connection so it can be reused- Returns:
- null if detach failed
-
getTransport
Transport getTransport()
Get the connection's data transport interface.- Returns:
- the transport - MAY BE NULL if not yet fully connected
-
isConnected
boolean isConnected()
-
setUserData
java.lang.Object setUserData(java.lang.Object key, java.lang.Object value)
-
getUserData
java.lang.Object getUserData(java.lang.Object key)
-
-