Examples of DistributedDatabaseContact


Examples of org.gudy.azureus2.plugins.ddb.DistributedDatabaseContact

                     
                      break;
                    }
                   
                    try{
                      DistributedDatabaseContact ddb_contact = ddb.importContact( contact.getAddress());
                     
                      if ( tryTest( bt_tester, ddb_contact )){
                       
                        synchronized( ok ){
                         
                          ok[0]++;
                        }
                      }
                    }catch( Throwable e ){
                     
                      listener.logError( "Contact import for " + contact.getName() + " failed", e );
                    }
                  }
                }finally{
                 
                  sem.release();
                }
              }
            }.start();
          }
         
          for (int i=0;i<num_threads;i++){
           
            sem.reserve();
          }
         
          listener.log( "Searching complete, " + ok[0] + " targets found" );
        }
      }else{
       
        String[]  bits = test_address.split( ":" );
       
        if ( bits.length != 2 ){
         
          log( "Invalid address - use <host>:<port> " );
         
          return( bt_tester );
        }
       
        InetSocketAddress address = new InetSocketAddress( bits[0].trim(), Integer.parseInt( bits[1].trim()));
        
        DistributedDatabaseContact contact = ddb.importContact( address );

        tryTest( bt_tester, contact );
      }
    }catch( Throwable e ){
     
View Full Code Here

Examples of org.gudy.azureus2.plugins.ddb.DistributedDatabaseContact

            continue;
          }
        }
       
        DistributedDatabaseContact  contact;
        boolean            live_contact;
       
        try{
          potential_contacts_mon.enter();
         
          // System.out.println( "rem=" + remaining + ",pot=" + potential_contacts.size() + ",out=" + outstanding[0] );
         
          if ( potential_contacts.size() == 0 ){
           
            if ( outstanding[0] == 0 ){
           
              break;
             
            }else{
             
              continue;
            }
          }else{
         
            Object[]  entry = (Object[])potential_contacts.remove(0);
           
            live_contact   = ((Boolean)entry[0]).booleanValue();
            contact     = (DistributedDatabaseContact)entry[1];
          }
         
        }finally{
         
          potential_contacts_mon.exit();
        }
         
        // System.out.println( "magnetDownload: " + contact.getName() + ", live = " + live_contact );
       
        if ( !live_contact ){
         
          listener.reportActivity( getMessageText( "report.tunnel", contact.getName()));

          contact.openTunnel();
        }
       
        try{
          listener.reportActivity( getMessageText( "report.downloading", contact.getName()));
         
          DistributedDatabaseValue  value =
            contact.read(
                new DistributedDatabaseProgressListener()
                {
                  public void
                  reportSize(
                    long  size )
                  {
                    listener.reportSize( size );
                  }
                  public void
                  reportActivity(
                    String  str )
                  {
                    listener.reportActivity( str );
                  }
                 
                  public void
                  reportCompleteness(
                    int    percent )
                  {
                    listener.reportCompleteness( percent );
                  }
                },
                db.getStandardTransferType( DistributedDatabaseTransferType.ST_TORRENT ),
                db.createKey ( hash , "Torrent download content for '" + ByteFormatter.encodeString( hash ) + "'"),
                timeout );
                   
          if ( value != null ){
           
              // let's verify the torrent
           
            byte[]  data = (byte[])value.getValue(byte[].class);

            try{
              TOTorrent torrent = TOTorrentFactory.deserialiseFromBEncodedByteArray( data );
             
              if ( Arrays.equals( hash, torrent.getHash())){
             
                listener.reportContributor( contact.getAddress());
           
                return( data );
               
              }else{
               
View Full Code Here

Examples of org.gudy.azureus2.plugins.ddb.DistributedDatabaseContact

             
              final int[]      done = {0};
             
              for (int i=0;i<ddb_contacts.size();i++){
               
                final DistributedDatabaseContact c = ddb_contacts.get( i );
                               
                new AEThread2( "RCM:rems", true )
                {
                  public void
                  run()
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.