Methods Summary |
---|
protected void | destroy(DHTUDPPacketHandler handler)
PRUDPPacketHandler packet_handler = handler.getPacketHandler();
try{
packet_handler.setRequestHandler(null);
}catch( Throwable e ){
Debug.printStackTrace(e);
}
int port = packet_handler.getPort();
int network = handler.getNetwork();
try{
this_mon.enter();
Object[] port_details = (Object[])port_map.remove( new Integer( port ));
if ( port_details == null ){
return;
}
Map network_map = (Map)port_details[1];
network_map.remove( new Integer( network ));
}finally{
this_mon.exit();
}
|
public static DHTUDPPacketHandler | getHandler(com.aelitis.azureus.core.dht.transport.udp.impl.DHTTransportUDPImpl transport, DHTUDPRequestHandler request_handler)
return( singleton.getHandlerSupport( transport, request_handler ));
|
protected DHTUDPPacketHandler | getHandlerSupport(com.aelitis.azureus.core.dht.transport.udp.impl.DHTTransportUDPImpl transport, DHTUDPRequestHandler request_handler)
try{
this_mon.enter();
int port = transport.getPort();
int network = transport.getNetwork();
Object[] port_details = (Object[])port_map.get( new Integer( port ));
if ( port_details == null ){
PRUDPPacketHandler packet_handler =
PRUDPPacketHandlerFactory.getHandler(
port,
new DHTUDPPacketNetworkHandler( this, port ));
port_details = new Object[]{ packet_handler, new HashMap()};
port_map.put( new Integer( port ), port_details );
}
Map network_map = (Map)port_details[1];
Object[] network_details = (Object[])network_map.get( new Integer( network ));
if ( network_details != null ){
throw( new DHTUDPPacketHandlerException( "Network already added" ));
}
DHTUDPPacketHandler ph = new DHTUDPPacketHandler( this, network, (PRUDPPacketHandler)port_details[0], request_handler );
network_map.put( new Integer( network ), new Object[]{ transport, ph });
return( ph );
}finally{
this_mon.exit();
}
|
public com.aelitis.azureus.core.dht.transport.udp.impl.DHTTransportUDPImpl | getTransport(int port, int network)
Object[] port_details = (Object[])port_map.get( new Integer( port ));
if ( port_details == null ){
throw( new IOException( "Port '" + port + "' not registered" ));
}
Map network_map = (Map)port_details[1];
Object[] network_details = (Object[])network_map.get( new Integer( network ));
if ( network_details == null ){
throw( new IOException( "Network '" + network + "' not registered" ));
}
return((DHTTransportUDPImpl)network_details[0]);
|
protected void | process(int port, com.aelitis.azureus.core.dht.transport.udp.impl.DHTUDPPacketRequest request)
try{
int network = request.getNetwork();
/*
if ( network != 0 ){
System.out.println( "process:" + network + ":" + request.getString());
}
*/
Object[] port_details = (Object[])port_map.get( new Integer( port ));
if ( port_details == null ){
throw( new IOException( "Port '" + port + "' not registered" ));
}
Map network_map = (Map)port_details[1];
Object[] network_details = (Object[])network_map.get( new Integer( network ));
if ( network_details == null ){
throw( new IOException( "Network '" + network + "' not registered" ));
}
DHTUDPPacketHandler res = (DHTUDPPacketHandler)network_details[1];
res.receive( request );
}catch( IOException e ){
Debug.printStackTrace( e );
}
|