Class UDPConnectionSet
java.lang.Object
com.biglybt.core.networkmanager.impl.udp.UDPConnectionSet
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Stringprivate final LinkedListprivate final Mapprivate booleanprivate longprivate longprivate UDPPacketprivate intprivate static final booleanprivate intprivate booleanprivate RC4Engineprivate RC4Engineprivate intprivate static final intprivate static final intprivate intprivate static final byte[]private static final byte[]private static final byte[]private static final byte[]private UDPConnectionprivate final intprivate static final LogIDsprivate final UDPConnectionManagerstatic final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final int(package private) static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intstatic final intprivate int(package private) booleanprivate Randomprivate static final intprivate final LinkedListprivate intprivate intprivate static final intprivate final Listprivate static final intprivate intprivate static final intprivate final InetSocketAddressprivate static final intprivate intprivate final UDPSelectorprivate longprivate longprivate intprivate static final intprivate static final intprivate intprivate intprivate intprivate intprivate longprivate static final intprivate static final intprivate static final intprivate static final intprivate booleanprivate intprivate intprivate intprivate intprivate intprivate intprivate intprivate intprivate intprivate intprivate intprivate intprivate longprivate final List -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedUDPConnectionSet(UDPConnectionManager _manager, String _connection_key, UDPSelector _selector, int _local_port, InetSocketAddress _remote_address) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidadd(UDPConnection connection) protected intbytesToInt(byte[] bytes, int offset) protected longbytesToLong(byte[] bytes) protected longbytesToLong(byte[] bytes, int offset) protected booleancanWrite(UDPConnection connection) protected intvoidclose(UDPConnection connection, String reason) protected voidvoidfailed(UDPConnection connection, Throwable reason) protected void(package private) static voidprivate RC4EnginegetCipher(byte[] key) protected intprotected StringgetKey()protected StringgetName()protected InetSocketAddressprotected UDPPacketprotected intprotected intgetRetransmitTicks(int resend_count) protected UDPSelectorprotected booleanprotected booleanprotected byte[]intToBytes(int i) protected voidlogStats()protected voidpoll()voidreceive(byte[] initial_data, int initial_data_length) protected voidreceiveAckCommand(ByteBuffer buffer) protected voidreceiveCloseCommand(ByteBuffer buffer) protected voidreceiveCrypto(ByteBuffer buffer) protected voidreceiveDataCommand(int sequence, ByteBuffer buffer, int header_length) protected voidreceiveStatsReply(ByteBuffer buffer) protected voidreceiveStatsRequest(ByteBuffer buffer) private voidreceiveTimerBase(int theirs) protected booleanremoteLastInSequence(int alt_sequence) protected booleanremove(UDPConnection connection) protected voidremoved()private voidprotected voidprotected voidprotected voidsendAckCommand(boolean timer_expired) protected voidsendCloseCommand(UDPConnection connection) protected intsendCrypto(ByteBuffer[] buffers, int offset, int length) protected intsendDataCommand(UDPConnection connection, ByteBuffer[] buffers, int offset, int length) protected voidprivate voidprotected voidsetSecret(UDPConnection connection, byte[] session_secret) protected voidprotected voidprotected voidprotected voidtrace(UDPConnection connection, String str) protected voidprotected intwrite(UDPConnection connection, ByteBuffer[] buffers, int offset, int length) protected intwriteHeaderEnd(ByteBuffer buffer, boolean randomise_size) protected int[]writeHeaderStart(ByteBuffer buffer, byte command, byte flags)
-
Field Details
-
LOGID
-
DEBUG_SEQUENCES
private static final boolean DEBUG_SEQUENCES- See Also:
-
KEYA_IV
private static final byte[] KEYA_IV -
KEYB_IV
private static final byte[] KEYB_IV -
KEYC_IV
private static final byte[] KEYC_IV -
KEYD_IV
private static final byte[] KEYD_IV -
MIN_MSS
private static final int MIN_MSS- See Also:
-
MAX_HEADER
private static final int MAX_HEADER- See Also:
-
MIN_WRITE_PAYLOAD
public static final int MIN_WRITE_PAYLOAD- See Also:
-
MAX_BUFFERED_PAYLOAD
public static final int MAX_BUFFERED_PAYLOAD- See Also:
-
manager
-
selector
-
local_port
private final int local_port -
remote_address
-
outgoing
boolean outgoing -
connection_key
-
random
-
lead_connection
-
header_cipher_out
-
header_cipher_in
-
in_seq_generator
-
out_seq_generator
-
crypto_done
private volatile boolean crypto_done -
failed
private volatile boolean failed -
connections
-
connection_writers
-
total_tick_count
private long total_tick_count -
STATS_LOG_TIMER
private static final int STATS_LOG_TIMER- See Also:
-
STATS_LOG_TICKS
private static final int STATS_LOG_TICKS -
stats_log_ticks
private int stats_log_ticks -
IDLE_TIMER
private static final int IDLE_TIMER- See Also:
-
IDLE_TICKS
private static final int IDLE_TICKS -
idle_ticks
private int idle_ticks -
TIMER_BASE_DEFAULT
private static final int TIMER_BASE_DEFAULT- See Also:
-
TIMER_BASE_MIN
private static final int TIMER_BASE_MIN- See Also:
-
TIMER_BASE_MAX
private static final int TIMER_BASE_MAX- See Also:
-
current_timer_base
private int current_timer_base -
old_timer_base
private int old_timer_base -
timer_is_adjusting
private boolean timer_is_adjusting -
stats_packets_unique_sent
private int stats_packets_unique_sent -
stats_packets_resent_via_timer
private int stats_packets_resent_via_timer -
stats_packets_unique_received
private int stats_packets_unique_received -
stats_packets_duplicates
private int stats_packets_duplicates -
STATS_RESET_TIMER
private static final int STATS_RESET_TIMER- See Also:
-
stats_reset_time
private long stats_reset_time -
total_packets_sent
private int total_packets_sent -
total_data_sent
private int total_data_sent -
total_data_resent
private int total_data_resent -
total_protocol_sent
private int total_protocol_sent -
total_protocol_resent
private int total_protocol_resent -
total_packets_unique_sent
private int total_packets_unique_sent -
total_packets_received
private int total_packets_received -
total_packets_unique_received
private int total_packets_unique_received -
total_packets_duplicates
private int total_packets_duplicates -
total_packets_out_of_order
private int total_packets_out_of_order -
total_packets_resent_via_timer
private int total_packets_resent_via_timer -
total_packets_resent_via_ack
private int total_packets_resent_via_ack -
retransmit_ticks
private int retransmit_ticks -
current_retransmit_target
-
RETRANSMIT_COUNT_LIMIT
private static final int RETRANSMIT_COUNT_LIMIT- See Also:
-
MIN_RETRANSMIT_TIMER
private static final int MIN_RETRANSMIT_TIMER- See Also:
-
MIN_RETRANSMIT_TICKS
private static final int MIN_RETRANSMIT_TICKS -
MAX_RETRANSMIT_TIMER
private static final int MAX_RETRANSMIT_TIMER- See Also:
-
MAX_RETRANSMIT_TICKS
private static final int MAX_RETRANSMIT_TICKS -
MAX_TRANSMIT_UNACK_DATA_PACKETS
private static final int MAX_TRANSMIT_UNACK_DATA_PACKETS- See Also:
-
MAX_TRANSMIT_UNACK_PACKETS
private static final int MAX_TRANSMIT_UNACK_PACKETS- See Also:
-
transmit_unack_packets
-
MAX_CONTIGUOUS_RETRANS_FOR_ACK
private static final int MAX_CONTIGUOUS_RETRANS_FOR_ACK- See Also:
-
MIN_KEEPALIVE_TIMER
private static final int MIN_KEEPALIVE_TIMER- See Also:
-
MIN_KEEPALIVE_TICKS
private static final int MIN_KEEPALIVE_TICKS -
MAX_KEEPALIVE_TIMER
private static final int MAX_KEEPALIVE_TIMER- See Also:
-
MAX_KEEPALIVE_TICKS
private static final int MAX_KEEPALIVE_TICKS -
keep_alive_ticks
private int keep_alive_ticks -
receive_last_inorder_sequence
private int receive_last_inorder_sequence -
receive_last_inorder_alt_sequence
private int receive_last_inorder_alt_sequence -
receive_their_last_inorder_sequence
private int receive_their_last_inorder_sequence -
RECEIVE_UNACK_IN_SEQUENCE_LIMIT
private static final int RECEIVE_UNACK_IN_SEQUENCE_LIMIT- See Also:
-
current_receive_unack_in_sequence_count
private long current_receive_unack_in_sequence_count -
sent_receive_unack_in_sequence_count
private long sent_receive_unack_in_sequence_count -
RECEIVE_OUT_OF_ORDER_ACK_LIMIT
private static final int RECEIVE_OUT_OF_ORDER_ACK_LIMIT- See Also:
-
current_receive_out_of_order_count
private long current_receive_out_of_order_count -
sent_receive_out_of_order_count
private long sent_receive_out_of_order_count -
RECEIVE_DONE_SEQ_MAX
private static final int RECEIVE_DONE_SEQ_MAX- See Also:
-
receive_done_sequences
-
RECEIVE_OUT_OF_ORDER_PACKETS_MAX
private static final int RECEIVE_OUT_OF_ORDER_PACKETS_MAX- See Also:
-
receive_out_of_order_packets
-
explicitack_ticks
private int explicitack_ticks -
MAX_SEQ_MEMORY
static final int MAX_SEQ_MEMORY
-
-
Constructor Details
-
UDPConnectionSet
protected UDPConnectionSet(UDPConnectionManager _manager, String _connection_key, UDPSelector _selector, int _local_port, InetSocketAddress _remote_address)
-
-
Method Details
-
getSelector
-
getRemoteAddress
-
getKey
-
add
- Throws:
IOException
-
remove
-
poll
protected void poll() -
setSecret
-
getCipher
-
sendTimerBase
private void sendTimerBase() -
resetTimerStats
private void resetTimerStats() -
receiveTimerBase
private void receiveTimerBase(int theirs) -
timerTick
- Throws:
IOException
-
getRetransmitTicks
protected int getRetransmitTicks() -
getExplicitAckTicks
protected int getExplicitAckTicks() -
startKeepAliveTimer
protected void startKeepAliveTimer() -
stopKeepAliveTimer
protected void stopKeepAliveTimer() -
idleLimitExceeded
protected boolean idleLimitExceeded() -
getRetransmitPacket
-
getRetransmitTicks
protected int getRetransmitTicks(int resend_count) -
retransmitExpired
- Throws:
IOException
-
remoteLastInSequence
protected boolean remoteLastInSequence(int alt_sequence) -
dumpState
protected void dumpState() -
send
- Throws:
IOException
-
receive
- Throws:
IOException
-
sendCrypto
- Throws:
IOException
-
receiveCrypto
- Throws:
IOException
-
sendDataCommand
protected int sendDataCommand(UDPConnection connection, ByteBuffer[] buffers, int offset, int length) throws IOException - Throws:
IOException
-
receiveDataCommand
protected void receiveDataCommand(int sequence, ByteBuffer buffer, int header_length) throws IOException - Throws:
IOException
-
sendAckCommand
- Throws:
IOException
-
receiveAckCommand
- Throws:
IOException
-
sendStatsRequest
- Throws:
IOException
-
receiveStatsRequest
- Throws:
IOException
-
receiveStatsReply
- Throws:
IOException
-
sendCloseCommand
- Throws:
IOException
-
receiveCloseCommand
- Throws:
IOException
-
writeHeaderStart
- Throws:
IOException
-
writeHeaderEnd
- Throws:
IOException
-
write
protected int write(UDPConnection connection, ByteBuffer[] buffers, int offset, int length) throws IOException - Throws:
IOException
-
canWrite
-
close
-
failed
-
failed
-
hasFailed
protected boolean hasFailed() -
removed
protected void removed() -
forDocumentation
static void forDocumentation() -
cipherInt
-
bytesToInt
protected int bytesToInt(byte[] bytes, int offset) -
intToBytes
protected byte[] intToBytes(int i) -
bytesToLong
protected long bytesToLong(byte[] bytes) -
bytesToLong
protected long bytesToLong(byte[] bytes, int offset) -
getName
-
logStats
protected void logStats() -
trace
-
trace
-