Class TCPTransportImpl
java.lang.Object
com.biglybt.core.networkmanager.impl.TransportImpl
com.biglybt.core.networkmanager.impl.tcp.TCPTransportImpl
- All Implemented Interfaces:
Transport, TransportBase
Represents a peer TCP transport connection (eg. a network socket).
-
Nested Class Summary
Nested classes/interfaces inherited from interface Transport
Transport.ConnectListener -
Field Summary
FieldsModifier and TypeFieldDescription(package private) TCPConnectionManager.ConnectListener(package private) boolean(package private) String(package private) final boolean(package private) intboolean(package private) final boolean(package private) boolean(package private) static final LogIDsprivate static final int[]Set the transport to the given speed mode.(package private) AEProxyFactory.PluginProxyprivate final ProtocolEndpointTCPprivate byte[][]private intprivate intFields inherited from interface Transport
CR_BAD_PIECE_DATA, CR_DUPLICATE_PEER_ID, CR_INTERNAL_CONNECT_FAILED, CR_INVALID_INFO_HASH, CR_IP_BLOCKED, CR_NO_MEMORY, CR_NONE, CR_NOT_INTERESTED_UPLOAD_ONLY, CR_PEER_CHURN, CR_PORT_BLOCKED, CR_PROTOCOL_BLOCKED, CR_SELF_CONNECTION, CR_STOPPED_OR_REMOVED, CR_TIMEOUT, CR_TIMEOUT_ACTIVITY, CR_TIMEOUT_HANDSHAKE, CR_TIMEOUT_INTEREST, CR_TIMEOUT_REQUEST, CR_TOO_MANY_CONNECTIONS, CR_TOO_MANY_FILES, CR_UPLOAD_TO_UPLOAD, KEY_CLOSE_REASON, TRANSPORT_MODE_FAST, TRANSPORT_MODE_MEGA_TURBO, TRANSPORT_MODE_NORMAL, TRANSPORT_MODE_TURBO -
Constructor Summary
ConstructorsConstructorDescriptionTCPTransportImpl(ProtocolEndpointTCP endpoint, boolean use_crypto, boolean allow_fallback, byte[][] _shared_secrets) Constructor for disconnected (outbound) transport.TCPTransportImpl(ProtocolEndpointTCP endpoint, TransportHelperFilter filter) Constructor for connected (inbound) transport. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidclose(TransportHelper helper, String reason) voidClose the transport connection.protected voidconnectedOutbound(ByteBuffer remaining_initial_data, Transport.ConnectListener listener) voidconnectOutbound(ByteBuffer initial_data, Transport.ConnectListener listener, int priority) Request the transport connection be established.Get a textual description for this transport.intGet the socket channel used by the transport.Get the socket channel used by the transport.protected voidhandleCrypto(InetSocketAddress address, SocketChannel channel, ByteBuffer initial_data, int priority, Transport.ConnectListener listener) booleanisClosed()booleanbooleanisSOCKS()booleanisTCP()(package private) voidsetConnectResult(boolean ok) private voidsetTransportBuffersSizes(int send_bytes, int recv_bytes) voidsetTransportModes(int send_mode, int recv_mode) Set the transport to the given speed modes.Methods inherited from class TransportImpl
bindConnection, connectedInbound, connectedOutbound, getEncryption, getFilter, getUserData, isEncrypted, isReadyForRead, isReadyForWrite, read, readFailed, readyForRead, readyForWrite, setAlreadyRead, setFilter, setReadyForRead, setTrace, setUserData, unbindConnection, write, writeFailedMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Transport
bindConnection, connectedInbound, getEncryption, getTransportMode, getUserData, isEncrypted, read, setAlreadyRead, setReadyForRead, setTrace, setTransportMode, setUserData, unbindConnection, writeMethods inherited from interface TransportBase
isReadyForRead, isReadyForWrite
-
Field Details
-
LOGID
-
protocol_endpoint
-
connect_request_key
TCPConnectionManager.ConnectListener connect_request_key -
description
String description -
is_inbound_connection
final boolean is_inbound_connection -
transport_send_mode
private int transport_send_mode -
transport_recv_mode
private int transport_recv_mode -
has_been_closed
public volatile boolean has_been_closed -
connect_with_crypto
boolean connect_with_crypto -
fallback_count
int fallback_count -
fallback_allowed
final boolean fallback_allowed -
is_socks
boolean is_socks -
plugin_proxy
-
mode_map
private static final int[] mode_mapSet the transport to the given speed mode.
-
-
Constructor Details
-
TCPTransportImpl
public TCPTransportImpl(ProtocolEndpointTCP endpoint, boolean use_crypto, boolean allow_fallback, byte[][] _shared_secrets) Constructor for disconnected (outbound) transport. -
TCPTransportImpl
Constructor for connected (inbound) transport.- Parameters:
channel- connectionalready_read- bytes from the channel
-
-
Method Details
-
isIncoming
public boolean isIncoming() -
getSocketChannel
Get the socket channel used by the transport.- Returns:
- the socket channel
-
getTransportEndpoint
Description copied from interface:TransportGet the socket channel used by the transport.- Specified by:
getTransportEndpointin interfaceTransport- Returns:
- the socket channel
-
getTransportStartpoint
- Specified by:
getTransportStartpointin interfaceTransport- Overrides:
getTransportStartpointin classTransportImpl
-
getMssSize
public int getMssSize()- Specified by:
getMssSizein interfaceTransport
-
isTCP
public boolean isTCP()- Specified by:
isTCPin interfaceTransportBase
-
isSOCKS
public boolean isSOCKS()- Specified by:
isSOCKSin interfaceTransport- Overrides:
isSOCKSin classTransportImpl
-
getPluginProxy
- Specified by:
getPluginProxyin interfaceTransport- Overrides:
getPluginProxyin classTransportImpl
-
getProtocol
- Specified by:
getProtocolin interfaceTransport- Overrides:
getProtocolin classTransportImpl
-
getDescription
Get a textual description for this transport.- Specified by:
getDescriptionin interfaceTransportBase- Returns:
- description
-
connectOutbound
public void connectOutbound(ByteBuffer initial_data, Transport.ConnectListener listener, int priority) Request the transport connection be established. NOTE: Will automatically connect via configured proxy if necessary.- Specified by:
connectOutboundin interfaceTransport- Parameters:
listener- establishment failure/success listeneraddress- remote peer address to connect to
-
handleCrypto
protected void handleCrypto(InetSocketAddress address, SocketChannel channel, ByteBuffer initial_data, int priority, Transport.ConnectListener listener) -
setTransportBuffersSizes
private void setTransportBuffersSizes(int send_bytes, int recv_bytes) -
setTransportModes
public void setTransportModes(int send_mode, int recv_mode) Description copied from interface:TransportSet the transport to the given speed modes.- Specified by:
setTransportModesin interfaceTransport
-
connectedOutbound
protected void connectedOutbound(ByteBuffer remaining_initial_data, Transport.ConnectListener listener) -
close
-
setConnectResult
void setConnectResult(boolean ok) -
close
-
isClosed
-