Examples of DHTUDPPacketNetworkHandler


Examples of com.aelitis.azureus.core.dht.transport.udp.impl.packethandler.DHTUDPPacketNetworkHandler

              // router here but with a null-handler
           
            throw( new IOException( "No handler available for DHT packet decode" ));
          }
         
          DHTUDPPacketNetworkHandler  network_handler = (DHTUDPPacketNetworkHandler)handler.getRequestHandler();

          if ( network_handler == null ){
           
              // we an get this after a port change and the old port listener is still running (e.g.
              // its still doing UDP tracker)
           
            throw( new IOException( "No network handler available for DHT packet decode" ));
          }
         
          switch( action ){
            case ACT_REQUEST_PING:
            {
              return( new DHTUDPPacketRequestPing(network_handler,is, connection_id,transaction_id));
            }
            case ACT_REQUEST_STORE:
            {
              return( new DHTUDPPacketRequestStore(network_handler,is, connection_id,transaction_id));
            }
            case ACT_REQUEST_FIND_NODE:
            {
              return( new DHTUDPPacketRequestFindNode(network_handler,is, connection_id,transaction_id));
            }
            case ACT_REQUEST_FIND_VALUE:
            {
              return( new DHTUDPPacketRequestFindValue(network_handler,is, connection_id,transaction_id));
            }
            case ACT_REQUEST_STATS:
            {
              return( new DHTUDPPacketRequestStats(network_handler,is, connection_id, transaction_id));
            }
            case ACT_DATA:
            {
              return( new DHTUDPPacketData(network_handler,is, connection_id, transaction_id));
            }
            case ACT_REQUEST_KEY_BLOCK:
            {
              return( new DHTUDPPacketRequestKeyBlock(network_handler,is, connection_id, transaction_id));
            }
            case ACT_REQUEST_QUERY_STORE:
            {
              return( new DHTUDPPacketRequestQueryStorage(network_handler,is, connection_id, transaction_id));
            }
            default:
            {
              throw( new IOException( "Unknown action type" ));
            }
          }
        }
      };
     
    Map  request_decoders = new HashMap();
   
    request_decoders.put( new Integer( ACT_REQUEST_PING ), request_decoder );
    request_decoders.put( new Integer( ACT_REQUEST_STORE ), request_decoder );
    request_decoders.put( new Integer( ACT_REQUEST_FIND_NODE ), request_decoder );
    request_decoders.put( new Integer( ACT_REQUEST_FIND_VALUE ), request_decoder );
    request_decoders.put( new Integer( ACT_REQUEST_STATS ), request_decoder );   
    request_decoders.put( new Integer( ACT_DATA ), request_decoder );
    request_decoders.put( new Integer( ACT_REQUEST_KEY_BLOCK ), request_decoder );
    request_decoders.put( new Integer( ACT_REQUEST_QUERY_STORE ), request_decoder );
   
    PRUDPPacketRequest.registerDecoders( request_decoders )
     
   
   
    PRUDPPacketReplyDecoder  reply_decoder =
      new PRUDPPacketReplyDecoder()
      {
        public PRUDPPacketReply
        decode(
          PRUDPPacketHandler  handler,
          InetSocketAddress  originator,
          DataInputStream    is,
          int          action,
          int          transaction_id )
       
          throws IOException
        {
          if ( handler == null ){
           
              // most likely cause is DHT packet ending up on the UDP tracker as it'll get
              // router here but with a null-handler
         
            throw( new IOException( "No handler available for DHT packet decode" ));
          }
         
          DHTUDPPacketNetworkHandler  network_handler = (DHTUDPPacketNetworkHandler)handler.getRequestHandler();
         
          if ( network_handler == null ){
           
            // we an get this after a port change and the old port listener is still running (e.g.
            // its still doing UDP tracker)
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.