Package com.aelitis.azureus.core.dht.control

Examples of com.aelitis.azureus.core.dht.control.DHTControlContact


                   
                    Map<Byte,Integer>  counts = new TreeMap<Byte, Integer>();
                   
                    for ( DHTRouterContact r: contacts ){
                     
                      DHTControlContact contact = (DHTControlContact)r.getAttachment();
                     
                      byte v = contact.getTransportContact().getProtocolVersion();
                     
                      Integer count = counts.get( v );
                     
                      if ( count == null ){
                       
                        counts.put( v, 1 );
                       
                      }else{
                       
                        counts.put( v, count+1 );
                      }
                    }
                   
                    log.log( "Net " + dht.getTransport().getNetwork());
                   
                    int  total = contacts.size();
                   
                    if ( total == 0 ){
                     
                      log.log( "   no contacts" );
                     
                    }else{
                     
                      String ver = "";
                     
                      for ( Map.Entry<Byte, Integer> entry: counts.entrySet()){
                     
                        ver += (ver.length()==0?"":", " ) + entry.getKey() + "=" + 100*entry.getValue()/total + "%";
                      }
                     
                      log.log( "    contacts=" + total + ": " + ver );
                    }
                  }else if ( lc.equals( "testca" )){
                               
                    ((DHTTransportUDPImpl)transport).testExternalAddressChange();
                   
                  }else if ( lc.equals( "testnd" )){
                   
                    ((DHTTransportUDPImpl)transport).testNetworkAlive( false );
                   
                  }else if ( lc.equals( "testna" )){
                   
                    ((DHTTransportUDPImpl)transport).testNetworkAlive( true );
       
                  }else{
                   
                    int pos = c.indexOf( ' ' );
                   
                    if ( pos != -1 ){
                     
                      String  lhs = lc.substring(0,pos);
                      String  rhs = c.substring(pos+1);
                     
                      if ( lhs.equals( "set" )){
                       
                        pos  = rhs.indexOf( '=' );
                       
                        if ( pos != -1 ){
                         
                          DHTPlugin.this.put(
                              rhs.substring(0,pos).getBytes(),
                              "DHT Plugin: set",
                              rhs.substring(pos+1).getBytes(),
                              (byte)0,
                              log_polistener );
                        }
                      }else if ( lhs.equals( "get" )){
                       
                        DHTPlugin.this.get(
                          rhs.getBytes(), "DHT Plugin: get", (byte)0, 1, 10000, true, false, log_polistener );
 
                      }else if ( lhs.equals( "query" )){
                       
                        DHTPlugin.this.get(
                          rhs.getBytes(), "DHT Plugin: get", DHTPlugin.FLAG_STATS, 1, 10000, true, false, log_polistener );

                      }else if ( lhs.equals( "punch" )){

                        Map  originator_data = new HashMap();
                       
                        originator_data.put( "hello", "mum" );

                        DHTNATPuncher puncher = dht.getNATPuncher();
                       
                        if ( puncher != null ){
                       
                          puncher.punch( "Test", transport.getLocalContact(), null, originator_data );
                        }
                      }else if ( lhs.equals( "stats" )){
                       
                        try{
                          pos = rhs.lastIndexOf( ":" );
                         
                          DHTTransportContact  contact;
                         
                          if ( pos == -1 ){
                         
                            contact = transport.getLocalContact();
                           
                          }else{
                           
                            String  host = rhs.substring(0,pos);
                            int    port = Integer.parseInt( rhs.substring(pos+1));
                           
                            contact =
                                transport.importContact(
                                    new InetSocketAddress( host, port ),
                                    transport.getProtocolVersion());
                          }
                         
                          log.log( "Stats request to " + contact.getName());
                         
                          DHTTransportFullStats stats = contact.getStats();
                           
                          log.log( "Stats:" + (stats==null?"<null>":stats.getString()));
                           
                          DHTControlActivity[] activities = dht.getControl().getActivities();
                           
View Full Code Here


 
              List  l = dht.getControl().getContacts();
             
              for (int i=0;i<l.size();i++){
               
                DHTControlContact  c = (DHTControlContact)l.get(i);
               
                System.out.println( "  contact:" + c.getRouterContact().getString() + "/" + c.getTransportContact().getString());
              }
            }catch( Throwable e ){
             
              e.printStackTrace();
            }
View Full Code Here

    gc.setBackground(black); // Color of the squares

    // Draw all known positions of other contacts
    Iterator iter = contacts.iterator();
    while(iter.hasNext()) {
      DHTControlContact contact = (DHTControlContact) iter.next();
      DHTNetworkPosition _position = contact.getTransportContact().getNetworkPosition(DHTNetworkPosition.POSITION_TYPE_VIVALDI_V1);
      if ( _position == null ){
        continue;
      }
      VivaldiPosition position = (VivaldiPosition)_position;
      HeightCoordinatesImpl coord = (HeightCoordinatesImpl) position.getCoordinates();
View Full Code Here

TOP

Related Classes of com.aelitis.azureus.core.dht.control.DHTControlContact

Copyright © 2018 www.massapicom. 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.