Class PRUDPPacketHandlerSupport
java.lang.Object
com.biglybt.net.udp.uc.impl.PRUDPPacketHandlerSupport
- All Implemented Interfaces:
PRUDPPacketHandler
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate PRUDPPacketHandlerImplprivate AEMonitorprivate InetAddressprivate InetAddressprivate AESemaphoreprivate booleanprivate InetAddressprivate booleanprivate booleanprivate Throwableprivate longprivate static final LogIDsprivate static intprivate static final longprivate static final longprivate final PRUDPPacketHandlerImpl.PacketTransformerprivate final intprivate final CopyOnWriteList<PRUDPPrimordialHandler> private intprivate intprivate longprivate AEMonitorprivate AESemaphoreprivate AEThread2private PRUDPRequestHandlerprivate Map<Integer, PRUDPPacketHandlerRequestImpl> private intprivate longprivate AEMonitorprivate AESemaphoreprivate final List[]private AEThread2private DatagramSocketprivate final PRUDPPacketHandlerStatsImplprivate InetAddressprivate static longprivate static longprivate static longprivate static longprivate longprivate longprivate longprivate booleanprivate static booleanFields inherited from interface PRUDPPacketHandler
PRIORITY_HIGH, PRIORITY_IMMEDIATE, PRIORITY_LOW, PRIORITY_MEDIUM -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedPRUDPPacketHandlerSupport(int port, InetAddress bind_ip, PRUDPPacketHandlerImpl.PacketTransformer packet_transformer) protectedPRUDPPacketHandlerSupport(int _port, InetAddress _bind_ip, PRUDPPacketHandlerImpl.PacketTransformer _packet_transformer, PRUDPPacketHandlerStatsImpl _stats, CopyOnWriteList<PRUDPPrimordialHandler> _primordial_handlers, PRUDPRequestHandler _request_handler) -
Method Summary
Modifier and TypeMethodDescriptionvoidprotected voidcalcBind()protected voidcheckTargetAddress(InetSocketAddress address) protected booleanvoidvoiddestroy()intgetPort()longlongprivate DatagramSocketgetSocket(int port) private DatagramSocketgetSocket(InetSocketAddress address) getStats()booleanopenSession(InetSocketAddress target, String[] networks, String reason) voidprimordialSend(byte[] buffer, InetSocketAddress target) protected voidprocess(DatagramPacket dg_packet, long receive_time) private voidprotected voidreceiveLoop(AESemaphore init_sem) voidvoidsend(PRUDPPacket request_packet, InetSocketAddress destination_address) Send onlysendAndReceive(PRUDPPacket request_packet, InetSocketAddress destination_address) voidsendAndReceive(PRUDPPacket request_packet, InetSocketAddress destination_address, PRUDPPacketReceiver receiver, long timeout, int priority) Asynchronous send and receivesendAndReceive(PasswordAuthentication auth, PRUDPPacket request_packet, InetSocketAddress destination_address) Synchronous send and receivesendAndReceive(PasswordAuthentication auth, PRUDPPacket request_packet, InetSocketAddress destination_address, long timeout) sendAndReceive(PasswordAuthentication auth, PRUDPPacket request_packet, InetSocketAddress destination_address, long timeout, int priority) sendAndReceive(PasswordAuthentication auth, PRUDPPacket request_packet, InetSocketAddress destination_address, PRUDPPacketReceiver receiver, long timeout, int priority) private voidprotected voidsetDefaultBindAddress(InetAddress address) voidsetDelays(int _send_delay, int _receive_delay, int _queued_request_timeout) voidsetExplicitBindAddress(InetAddress address, boolean autoDelegate) voidsetRequestHandler(PRUDPRequestHandler _request_handler) Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface PRUDPPacketHandler
getBindIP
-
Field Details
-
LOGID
-
TRACE_REQUESTS
private boolean TRACE_REQUESTS -
MAX_PACKET_SIZE
private static int MAX_PACKET_SIZE -
total_packets_sent
private static volatile long total_packets_sent -
total_packets_received
private static volatile long total_packets_received -
total_bytes_sent
private static volatile long total_bytes_sent -
total_bytes_received
private static volatile long total_bytes_received -
MAX_SEND_QUEUE_DATA_SIZE
private static final long MAX_SEND_QUEUE_DATA_SIZE- See Also:
-
MAX_RECV_QUEUE_DATA_SIZE
private static final long MAX_RECV_QUEUE_DATA_SIZE- See Also:
-
use_socks
private static boolean use_socks -
port
private final int port -
socket
-
primordial_handlers
-
stats
-
request_handler
-
requests
-
send_queue_mon
-
send_queue_data_size
private long send_queue_data_size -
send_queues
-
send_queue_sem
-
send_thread
-
recv_queue_mon
-
recv_queue_data_size
private long recv_queue_data_size -
recv_queue
-
recv_queue_sem
-
recv_thread
-
send_delay
private int send_delay -
receive_delay
private int receive_delay -
queued_request_timeout
private int queued_request_timeout -
total_requests_received
private long total_requests_received -
total_requests_processed
private long total_requests_processed -
total_replies
private long total_replies -
last_error_report
private long last_error_report -
bind_address_mon
-
default_bind_ip
-
explicit_bind_ip
-
explicit_bind_ip_ad
private boolean explicit_bind_ip_ad -
current_bind_ip
-
target_bind_ip
-
failed
private volatile boolean failed -
destroyed
private volatile boolean destroyed -
destroy_sem
-
init_error
-
altProtocolDelegate
-
packet_transformer
-
-
Constructor Details
-
PRUDPPacketHandlerSupport
protected PRUDPPacketHandlerSupport(int port, InetAddress bind_ip, PRUDPPacketHandlerImpl.PacketTransformer packet_transformer) -
PRUDPPacketHandlerSupport
protected PRUDPPacketHandlerSupport(int _port, InetAddress _bind_ip, PRUDPPacketHandlerImpl.PacketTransformer _packet_transformer, PRUDPPacketHandlerStatsImpl _stats, CopyOnWriteList<PRUDPPrimordialHandler> _primordial_handlers, PRUDPRequestHandler _request_handler)
-
-
Method Details
-
hasPrimordialHandler
public boolean hasPrimordialHandler()- Specified by:
hasPrimordialHandlerin interfacePRUDPPacketHandler
-
addPrimordialHandler
- Specified by:
addPrimordialHandlerin interfacePRUDPPacketHandler
-
removePrimordialHandler
- Specified by:
removePrimordialHandlerin interfacePRUDPPacketHandler
-
setRequestHandler
- Specified by:
setRequestHandlerin interfacePRUDPPacketHandler
-
getRequestHandler
- Specified by:
getRequestHandlerin interfacePRUDPPacketHandler
-
getPort
public int getPort()- Specified by:
getPortin interfacePRUDPPacketHandler
-
getCurrentBindAddress
- Specified by:
getCurrentBindAddressin interfacePRUDPPacketHandler
-
setDefaultBindAddress
-
getExplicitBindAddress
- Specified by:
getExplicitBindAddressin interfacePRUDPPacketHandler
-
setExplicitBindAddress
- Specified by:
setExplicitBindAddressin interfacePRUDPPacketHandler
-
calcBind
protected void calcBind() -
getSocket
- Throws:
SocketException
-
getSocket
- Throws:
SocketException
-
receiveLoop
-
checkTimeouts
protected boolean checkTimeouts() -
process
-
sendAndReceive
public PRUDPPacket sendAndReceive(PRUDPPacket request_packet, InetSocketAddress destination_address) throws PRUDPPacketHandlerException - Throws:
PRUDPPacketHandlerException
-
sendAndReceive
public PRUDPPacket sendAndReceive(PasswordAuthentication auth, PRUDPPacket request_packet, InetSocketAddress destination_address) throws PRUDPPacketHandlerException Description copied from interface:PRUDPPacketHandlerSynchronous send and receive- Specified by:
sendAndReceivein interfacePRUDPPacketHandler- Parameters:
auth-request_packet-destination_address-- Returns:
- Throws:
PRUDPPacketHandlerException
-
sendAndReceive
public PRUDPPacket sendAndReceive(PasswordAuthentication auth, PRUDPPacket request_packet, InetSocketAddress destination_address, long timeout) throws PRUDPPacketHandlerException - Specified by:
sendAndReceivein interfacePRUDPPacketHandler- Throws:
PRUDPPacketHandlerException
-
sendAndReceive
public PRUDPPacket sendAndReceive(PasswordAuthentication auth, PRUDPPacket request_packet, InetSocketAddress destination_address, long timeout, int priority) throws PRUDPPacketHandlerException - Specified by:
sendAndReceivein interfacePRUDPPacketHandler- Throws:
PRUDPPacketHandlerException
-
sendAndReceive
public void sendAndReceive(PRUDPPacket request_packet, InetSocketAddress destination_address, PRUDPPacketReceiver receiver, long timeout, int priority) throws PRUDPPacketHandlerException Description copied from interface:PRUDPPacketHandlerAsynchronous send and receive- Specified by:
sendAndReceivein interfacePRUDPPacketHandler- Parameters:
request_packet-destination_address-receiver-- Throws:
PRUDPPacketHandlerException
-
sendAndReceive
public PRUDPPacketHandlerRequestImpl sendAndReceive(PasswordAuthentication auth, PRUDPPacket request_packet, InetSocketAddress destination_address, PRUDPPacketReceiver receiver, long timeout, int priority) throws PRUDPPacketHandlerException - Throws:
PRUDPPacketHandlerException
-
send
public void send(PRUDPPacket request_packet, InetSocketAddress destination_address) throws PRUDPPacketHandlerException Description copied from interface:PRUDPPacketHandlerSend only- Specified by:
sendin interfacePRUDPPacketHandler- Parameters:
request_packet-destination_address-- Throws:
PRUDPPacketHandlerException
-
checkTargetAddress
- Throws:
PRUDPPacketHandlerException
-
setDelays
public void setDelays(int _send_delay, int _receive_delay, int _queued_request_timeout) - Specified by:
setDelaysin interfacePRUDPPacketHandler
-
getSendQueueLength
public long getSendQueueLength() -
getReceiveQueueLength
public long getReceiveQueueLength() -
primordialSend
public void primordialSend(byte[] buffer, InetSocketAddress target) throws PRUDPPacketHandlerException - Specified by:
primordialSendin interfacePRUDPPacketHandler- Throws:
PRUDPPacketHandlerException
-
sendToSocket
- Throws:
IOException
-
receiveFromSocket
- Throws:
IOException
-
getStats
- Specified by:
getStatsin interfacePRUDPPacketHandler
-
destroy
public void destroy()- Specified by:
destroyin interfacePRUDPPacketHandler
-
openSession
public PRUDPPacketHandler openSession(InetSocketAddress target, String[] networks, String reason) throws PRUDPPacketHandlerException - Specified by:
openSessionin interfacePRUDPPacketHandler- Throws:
PRUDPPacketHandlerException
-
closeSession
- Specified by:
closeSessionin interfacePRUDPPacketHandler- Throws:
PRUDPPacketHandlerException
-