Package org.gudy.azureus2.plugins.peers

Examples of org.gudy.azureus2.plugins.peers.PeerManager


                delegate.close();
               
              }catch( Throwable e ){
              }
             
              reportFailed( new MessageException( "Connection has been closed" ));

            }else{
             
              reportConnected();
            }
View Full Code Here


              final InetSocketAddress  target,
              Map            reply )
            {
              if ( closed ){
                             
                reportFailed( new MessageException( "Connection has been closed" ));

              }else{
               
                connect_method_count++;

                if ( TEST_TUNNEL ){
                 
                  initial_data.rewind();
                 
                  connectTunnel( initial_data, gen_udp, rendezvous, target );
                 
                }else{
               
                  udp_delegate.connect(
                      initial_data,
                      new GenericMessageConnectionAdapter.ConnectionListener()
                      {
                        private boolean  connected;
                       
                        public void
                        connectSuccess()
                        {
                          connected  = true;
                         
                          setDelegate( udp_delegate );
                         
                          if ( closed ){
                           
                            try{
                              delegate.close();
                             
                            }catch( Throwable e ){                         
                            }
                           
                            reportFailed( new MessageException( "Connection has been closed" ));
                           
                          }else{
                           
                            reportConnected();
                          }                       
                        }
                       
                        public void
                        connectFailure(
                          Throwable failure_msg )
                        {
                          if ( connected ){
                           
                            reportFailed( failure_msg );
                           
                          }else{
                           
                            initial_data.rewind();
 
                            connectTunnel( initial_data, gen_udp, rendezvous, target );
                          }
                        }
                      });
                }
              }
            }
           
            public void
            failed(
              int      failure_type )
            {
              reportFailed( new MessageException( "UDP connection attempt failed - NAT traversal failed (" + NATTraversalObserver.FT_STRINGS[ failure_type ] + ")"));
            }
           
            public void
            failed(
              Throwable   cause )
            {
              reportFailed( cause );
            }
           
            public void
            disabled()
            {
              reportFailed( new MessageException( "UDP connection attempt failed as DDB is disabled" ));
            }
          });
    }else{
 
      udp_delegate.connect(
          initial_data,
          new GenericMessageConnectionAdapter.ConnectionListener()
          {
            private boolean  connected;
           
            public void
            connectSuccess()
            {
              connected  = true;
             
              setDelegate( udp_delegate );
             
              if ( closed ){
               
                try{
                  delegate.close();
                 
                }catch( Throwable e ){ 
                }
               
                reportFailed( new MessageException( "Connection has been closed" ));

              }else{
               
                reportConnected();
              }
View Full Code Here

               
              }catch( Throwable e ){
               
              }
             
              reportFailed( new MessageException( "Connection has been closed" ));

            }else{
             
              reportConnected();
            }
View Full Code Here

  {
    int  size = ((PooledByteBufferImpl)message).getBuffer().remaining( DirectByteBuffer.SS_EXTERNAL );
   
    if ( size > getMaximumMessageSize()){
     
      throw( new MessageException( "Message is too large: supplied is " + size + ", maximum is " + getMaximumMessageSize()));
    }
   
    delegate.send( message );
  }
View Full Code Here

          public MessageStreamEncoder createEncoder() {  return new GenericMessageEncoder();}
          public MessageStreamDecoder createDecoder() {  return new GenericMessageDecoder(type, description);}
        });
   
  return(
    new GenericMessageRegistration()
    {
      public GenericMessageEndpoint
      createEndpoint(
        InetSocketAddress  notional_target )
      {
View Full Code Here

    }
    else {
      plug_msg = new MessageAdapter( message )//core created
    }
   
    RawMessage raw_plug = plug_encoder.encodeMessage( plug_msg );
    return new com.aelitis.azureus.core.networkmanager.RawMessage[]{ new RawMessageAdapter( raw_plug )};
  }
View Full Code Here

  }
 
  public int
  getSeedCount()
  {
    PeerManager  pm = download.getPeerManager();
       
    if ( pm != null ){
     
      return( pm.getStats().getConnectedSeeds());
    }
   
    return( 0 );
  }
View Full Code Here

  }
 
  public int
  getNonSeedCount()
  {
    PeerManager  pm = download.getPeerManager();
   
    if ( pm != null ){
     
      return( pm.getStats().getConnectedLeechers());
    }
   
    return( 0 );
  }
View Full Code Here

        // if the peer manager's changed then we always go inactive for a period to wait for
        // download status to stabilise a bit
     
      peer_manager_change_time  = now;
     
      PeerManager existing_manager = current_manager;
     
      if ( current_manager != null ){
       
        current_manager.removeListener( this );
      }
View Full Code Here

     
      for (int i=0;i<downloads.size();i++){
       
        Download  download = (Download)downloads.get(i);
       
        PeerManager pm = download.getPeerManager();
       
        if ( pm == null ){
         
          continue;
        }
       
        Peer[] existing_peers = pm.getPeers( ip.getHostAddress());
     
        boolean  connected = false;
       
        for (int j=0;j<existing_peers.length;j++){
         
View Full Code Here

TOP

Related Classes of org.gudy.azureus2.plugins.peers.PeerManager

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.