Package com.biglybt.net.udp.uc.impl
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 PRUDPPacketHandlerImpl
private AEMonitor
private InetAddress
private InetAddress
private AESemaphore
private boolean
private InetAddress
private boolean
private boolean
private Throwable
private long
private static final LogIDs
private static int
private static final long
private static final long
private final PRUDPPacketHandlerImpl.PacketTransformer
private final int
private final CopyOnWriteList
<PRUDPPrimordialHandler> private int
private int
private long
private AEMonitor
private AESemaphore
private AEThread2
private PRUDPRequestHandler
private Map
<Integer, PRUDPPacketHandlerRequestImpl> private int
private long
private AEMonitor
private AESemaphore
private final List[]
private AEThread2
private DatagramSocket
private final PRUDPPacketHandlerStatsImpl
private InetAddress
private static long
private static long
private static long
private static long
private long
private long
private long
private boolean
private static boolean
Fields inherited from interface com.biglybt.net.udp.uc.PRUDPPacketHandler
PRIORITY_HIGH, PRIORITY_IMMEDIATE, PRIORITY_LOW, PRIORITY_MEDIUM
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
PRUDPPacketHandlerSupport
(int port, InetAddress bind_ip, PRUDPPacketHandlerImpl.PacketTransformer packet_transformer) protected
PRUDPPacketHandlerSupport
(int _port, InetAddress _bind_ip, PRUDPPacketHandlerImpl.PacketTransformer _packet_transformer, PRUDPPacketHandlerStatsImpl _stats, CopyOnWriteList<PRUDPPrimordialHandler> _primordial_handlers, PRUDPRequestHandler _request_handler) -
Method Summary
Modifier and TypeMethodDescriptionvoid
protected void
calcBind()
protected void
checkTargetAddress
(InetSocketAddress address) protected boolean
void
void
destroy()
int
getPort()
long
long
private DatagramSocket
getSocket
(int port) private DatagramSocket
getSocket
(InetSocketAddress address) getStats()
boolean
openSession
(InetSocketAddress target) void
primordialSend
(byte[] buffer, InetSocketAddress target) protected void
process
(DatagramPacket dg_packet, long receive_time) private void
protected void
receiveLoop
(AESemaphore init_sem) void
void
send
(PRUDPPacket request_packet, InetSocketAddress destination_address) Send onlysendAndReceive
(PRUDPPacket request_packet, InetSocketAddress destination_address) void
sendAndReceive
(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 void
protected void
setDefaultBindAddress
(InetAddress address) void
setDelays
(int _send_delay, int _receive_delay, int _queued_request_timeout) void
setExplicitBindAddress
(InetAddress address, boolean autoDelegate) void
setRequestHandler
(PRUDPRequestHandler _request_handler) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.biglybt.net.udp.uc.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:
hasPrimordialHandler
in interfacePRUDPPacketHandler
-
addPrimordialHandler
- Specified by:
addPrimordialHandler
in interfacePRUDPPacketHandler
-
removePrimordialHandler
- Specified by:
removePrimordialHandler
in interfacePRUDPPacketHandler
-
setRequestHandler
- Specified by:
setRequestHandler
in interfacePRUDPPacketHandler
-
getRequestHandler
- Specified by:
getRequestHandler
in interfacePRUDPPacketHandler
-
getPort
public int getPort()- Specified by:
getPort
in interfacePRUDPPacketHandler
-
getCurrentBindAddress
- Specified by:
getCurrentBindAddress
in interfacePRUDPPacketHandler
-
setDefaultBindAddress
-
getExplicitBindAddress
- Specified by:
getExplicitBindAddress
in interfacePRUDPPacketHandler
-
setExplicitBindAddress
- Specified by:
setExplicitBindAddress
in 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:PRUDPPacketHandler
Synchronous send and receive- Specified by:
sendAndReceive
in 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:
sendAndReceive
in interfacePRUDPPacketHandler
- Throws:
PRUDPPacketHandlerException
-
sendAndReceive
public PRUDPPacket sendAndReceive(PasswordAuthentication auth, PRUDPPacket request_packet, InetSocketAddress destination_address, long timeout, int priority) throws PRUDPPacketHandlerException - Specified by:
sendAndReceive
in 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:PRUDPPacketHandler
Asynchronous send and receive- Specified by:
sendAndReceive
in 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:PRUDPPacketHandler
Send only- Specified by:
send
in 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:
setDelays
in interfacePRUDPPacketHandler
-
getSendQueueLength
public long getSendQueueLength() -
getReceiveQueueLength
public long getReceiveQueueLength() -
primordialSend
public void primordialSend(byte[] buffer, InetSocketAddress target) throws PRUDPPacketHandlerException - Specified by:
primordialSend
in interfacePRUDPPacketHandler
- Throws:
PRUDPPacketHandlerException
-
sendToSocket
- Throws:
IOException
-
receiveFromSocket
- Throws:
IOException
-
getStats
- Specified by:
getStats
in interfacePRUDPPacketHandler
-
destroy
public void destroy()- Specified by:
destroy
in interfacePRUDPPacketHandler
-
openSession
- Specified by:
openSession
in interfacePRUDPPacketHandler
- Throws:
PRUDPPacketHandlerException
-
closeSession
- Specified by:
closeSession
in interfacePRUDPPacketHandler
- Throws:
PRUDPPacketHandlerException
-