Class UDPConnectionSet
java.lang.Object
com.biglybt.core.networkmanager.impl.udp.UDPConnectionSet
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final String
private final LinkedList
private final Map
private boolean
private long
private long
private UDPPacket
private int
private static final boolean
private int
private boolean
private RC4Engine
private RC4Engine
private int
private static final int
private static final int
private int
private static final byte[]
private static final byte[]
private static final byte[]
private static final byte[]
private UDPConnection
private final int
private static final LogIDs
private final UDPConnectionManager
static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
(package private) static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
static final int
private int
(package private) boolean
private Random
private static final int
private final LinkedList
private int
private int
private static final int
private final List
private static final int
private int
private static final int
private final InetSocketAddress
private static final int
private int
private final UDPSelector
private long
private long
private int
private static final int
private static final int
private int
private int
private int
private int
private long
private static final int
private static final int
private static final int
private static final int
private boolean
private int
private int
private int
private int
private int
private int
private int
private int
private int
private int
private int
private int
private long
private final List
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
UDPConnectionSet
(UDPConnectionManager _manager, String _connection_key, UDPSelector _selector, int _local_port, InetSocketAddress _remote_address) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
add
(UDPConnection connection) protected int
bytesToInt
(byte[] bytes, int offset) protected long
bytesToLong
(byte[] bytes) protected long
bytesToLong
(byte[] bytes, int offset) protected boolean
canWrite
(UDPConnection connection) protected int
void
close
(UDPConnection connection, String reason) protected void
void
failed
(UDPConnection connection, Throwable reason) protected void
(package private) static void
private RC4Engine
getCipher
(byte[] key) protected int
protected String
getKey()
protected String
getName()
protected InetSocketAddress
protected UDPPacket
protected int
protected int
getRetransmitTicks
(int resend_count) protected UDPSelector
protected boolean
protected boolean
protected byte[]
intToBytes
(int i) protected void
logStats()
protected void
poll()
void
receive
(byte[] initial_data, int initial_data_length) protected void
receiveAckCommand
(ByteBuffer buffer) protected void
receiveCloseCommand
(ByteBuffer buffer) protected void
receiveCrypto
(ByteBuffer buffer) protected void
receiveDataCommand
(int sequence, ByteBuffer buffer, int header_length) protected void
receiveStatsReply
(ByteBuffer buffer) protected void
receiveStatsRequest
(ByteBuffer buffer) private void
receiveTimerBase
(int theirs) protected boolean
remoteLastInSequence
(int alt_sequence) protected boolean
remove
(UDPConnection connection) protected void
removed()
private void
protected void
protected void
protected void
sendAckCommand
(boolean timer_expired) protected void
sendCloseCommand
(UDPConnection connection) protected int
sendCrypto
(ByteBuffer[] buffers, int offset, int length) protected int
sendDataCommand
(UDPConnection connection, ByteBuffer[] buffers, int offset, int length) protected void
private void
protected void
setSecret
(UDPConnection connection, byte[] session_secret) protected void
protected void
protected void
protected void
trace
(UDPConnection connection, String str) protected void
protected int
write
(UDPConnection connection, ByteBuffer[] buffers, int offset, int length) protected int
writeHeaderEnd
(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
-