Class NetworkConnectionImpl.bogusTransport
java.lang.Object
com.biglybt.core.networkmanager.impl.NetworkConnectionImpl.bogusTransport
- All Implemented Interfaces:
Transport
,TransportBase
- Enclosing class:
NetworkConnectionImpl
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.biglybt.core.networkmanager.Transport
Transport.ConnectListener
-
Field Summary
FieldsFields inherited from interface com.biglybt.core.networkmanager.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_NORMAL, TRANSPORT_MODE_TURBO
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
bindConnection
(NetworkConnection connection) void
Close the transport connection.void
Indicate that inbound connection is completevoid
connectOutbound
(ByteBuffer initial_data, Transport.ConnectListener listener, int priority) Kick off an outbound connectionGet a textual description for this transport.getEncryption
(boolean verbose) Return a textual description of the encryption for this transportint
Get the socket channel used by the transport.int
Get the transport's speed mode.getUserData
(Object key) boolean
isClosed()
boolean
long
isReadyForRead
(EventWaiter waiter) Is the transport ready to read, i.e.boolean
isReadyForWrite
(EventWaiter waiter) Is the transport ready to write, i.e.boolean
isSOCKS()
boolean
isTCP()
long
read
(ByteBuffer[] buffers, int array_offset, int length) Read data from the transport into the given buffers.void
setAlreadyRead
(ByteBuffer bytes_already_read) Inject the given already-read data back into the read stream.void
fake a wakeup so that a read cycle is attemptedvoid
setTrace
(boolean on) void
setTransportMode
(int mode) Set the transport to the given speed mode.void
setUserData
(Object key, Object value) void
unbindConnection
(NetworkConnection connection) long
write
(ByteBuffer[] buffers, int array_offset, int length) Write data to the transport from the given buffers.
-
Field Details
-
transport
-
-
Constructor Details
-
bogusTransport
-
-
Method Details
-
isReadyForWrite
Description copied from interface:TransportBase
Is the transport ready to write, i.e. will a write request result in >0 bytes written.- Specified by:
isReadyForWrite
in interfaceTransportBase
- Returns:
- true if the transport is write ready, false if not yet ready
-
isReadyForRead
Description copied from interface:TransportBase
Is the transport ready to read, i.e. will a read request result in >0 bytes read.- Specified by:
isReadyForRead
in interfaceTransportBase
- Returns:
- 0 if the transport is read ready, ms since last ready or created if never ready
-
isTCP
public boolean isTCP()- Specified by:
isTCP
in interfaceTransportBase
-
isSOCKS
public boolean isSOCKS() -
getPluginProxy
- Specified by:
getPluginProxy
in interfaceTransport
-
getDescription
Description copied from interface:TransportBase
Get a textual description for this transport.- Specified by:
getDescription
in interfaceTransportBase
- Returns:
- description
-
getMssSize
public int getMssSize()- Specified by:
getMssSize
in interfaceTransport
-
setAlreadyRead
Description copied from interface:Transport
Inject the given already-read data back into the read stream.- Specified by:
setAlreadyRead
in interfaceTransport
- Parameters:
bytes_already_read
- data
-
getTransportEndpoint
Description copied from interface:Transport
Get the socket channel used by the transport.- Specified by:
getTransportEndpoint
in interfaceTransport
- Returns:
- the socket channel
-
getTransportStartpoint
- Specified by:
getTransportStartpoint
in interfaceTransport
-
isEncrypted
public boolean isEncrypted()- Specified by:
isEncrypted
in interfaceTransport
-
getEncryption
Description copied from interface:Transport
Return a textual description of the encryption for this transport- Specified by:
getEncryption
in interfaceTransport
- Returns:
-
getProtocol
- Specified by:
getProtocol
in interfaceTransport
-
setReadyForRead
public void setReadyForRead()Description copied from interface:Transport
fake a wakeup so that a read cycle is attempted- Specified by:
setReadyForRead
in interfaceTransport
-
write
Description copied from interface:Transport
Write data to the transport from the given buffers. NOTE: Works like GatheringByteChannel.- Specified by:
write
in interfaceTransport
- Parameters:
buffers
- from which bytes are to be retrievedarray_offset
- offset within the buffer array of the first buffer from which bytes are to be retrievedlength
- maximum number of buffers to be accessed- Returns:
- number of bytes written
- Throws:
IOException
- on write error
-
read
Description copied from interface:Transport
Read data from the transport into the given buffers. NOTE: Works like ScatteringByteChannel.- Specified by:
read
in interfaceTransport
- Parameters:
buffers
- into which bytes are to be placedarray_offset
- offset within the buffer array of the first buffer into which bytes are to be placedlength
- maximum number of buffers to be accessed- Returns:
- number of bytes read
- Throws:
IOException
- on read error
-
setTransportMode
public void setTransportMode(int mode) Description copied from interface:Transport
Set the transport to the given speed mode.- Specified by:
setTransportMode
in interfaceTransport
- Parameters:
mode
- to change to
-
getTransportMode
public int getTransportMode()Description copied from interface:Transport
Get the transport's speed mode.- Specified by:
getTransportMode
in interfaceTransport
- Returns:
- current mode
-
connectOutbound
public void connectOutbound(ByteBuffer initial_data, Transport.ConnectListener listener, int priority) Description copied from interface:Transport
Kick off an outbound connection- Specified by:
connectOutbound
in interfaceTransport
- Parameters:
listener
-
-
connectedInbound
public void connectedInbound()Description copied from interface:Transport
Indicate that inbound connection is complete- Specified by:
connectedInbound
in interfaceTransport
-
close
Description copied from interface:Transport
Close the transport connection. -
isClosed
public boolean isClosed() -
bindConnection
- Specified by:
bindConnection
in interfaceTransport
-
unbindConnection
- Specified by:
unbindConnection
in interfaceTransport
-
getUserData
- Specified by:
getUserData
in interfaceTransport
-
setUserData
- Specified by:
setUserData
in interfaceTransport
-
setTrace
public void setTrace(boolean on)
-