Package org.gudy.azureus2.core3.tracker.client

Examples of org.gudy.azureus2.core3.tracker.client.TRTrackerAnnouncer


  }
   
  public String
  getStatusString()
  {   
    TRTrackerAnnouncer  max_announcer = getBestAnnouncer();
   
    return( max_announcer==null?"":max_announcer.getStatusString());
  }
View Full Code Here


  public TRTrackerAnnouncer
  getBestAnnouncer()
  {
    int  max = -1;
   
    TRTrackerAnnouncer  max_announcer = null;
   
    for ( TRTrackerAnnouncer announcer: announcers ){
     
      int  status = announcer.getStatus();
     
View Full Code Here

    if ( SystemTime.getMonotonousTime() - create_time < 15*1000 ){
     
      return( 0 );
    }
   
    TRTrackerAnnouncer active = getBestActive();
   
    if ( active != null && provider != null && active.getStatus() == TRTrackerAnnouncerResponse.ST_ONLINE ){
     
      if (   provider.getMaxNewConnectionsAllowed() > 0 &&
          provider.getPendingConnectionCount() == 0 ){
       
        return( 5 );
View Full Code Here

       
        Long  last_announce_l = (Long)dm.getUserData( DM_ANNOUNCE_KEY );
       
        long  last_announce  = last_announce_l==null?create_time:last_announce_l.longValue();
       
        TRTrackerAnnouncer an = dm.getTrackerClient();
       
        if ( an != null ){
         
          TRTrackerAnnouncerResponse last_announce_response = an.getLastResponse();
         
          if (   now - last_announce > 15*60*1000 ||
              last_announce_response == null ||
              last_announce_response.getStatus() == TRTrackerAnnouncerResponse.ST_OFFLINE ||
              force ){
View Full Code Here

  {
   
      // use a facade here to delay loading the actual torrent until the
      // download is activated
 
    TRTrackerAnnouncer result = TRTrackerAnnouncerFactory.create( torrent_facade, true );
   
    result.addListener(
        new TRTrackerAnnouncerListener()
        {
          public void
          receivedTrackerResponse(
            TRTrackerAnnouncerResponse  response )
          {
            TRTrackerAnnouncerResponsePeer[] peers = response.getPeers();
           
              // tracker shouldn't return seeds to seeds to we can assume
              // that if peers returned this means we have someone to talk to
         
            if ( peers != null && peers.length > 0 ){
           
              ensureActive( "Tracker[" + peers[0].getAddress()+ "]", ACT_TRACKER_ANNOUNCE );
             
            }else if ( response.getScrapeIncompleteCount() > 0 ){
             
              ensureActive( "Tracker[scrape]", ACT_TRACKER_SCRAPE );
            }
           
            PEPeerManager  pm = peer_manager;
           
            if ( pm != null ){
                             
              pm.processTrackerResponse( response );
            }
          }
 
          public void
          urlChanged(
            TRTrackerAnnouncer  announcer,
            URL          old_url,
            URL          new_url,
            boolean        explicit )
          {
          }
           
          public void
          urlRefresh()
          { 
          }
        });
     
    result.setAnnounceDataProvider(
        new TRTrackerAnnouncerDataProvider()
        {
          public String
          getName()
          {
View Full Code Here

  }
 
  public DownloadAnnounceResult
  getLastAnnounceResult()
  {
    TRTrackerAnnouncer tc = download_manager.getTrackerClient();
   
    if ( tc != null ){
     
      last_announce_result.setContent( tc.getLastResponse());
    }
   
    return( last_announce_result );
  }
View Full Code Here

  }
 
  public void
  torrentChanged()
  {
    TRTrackerAnnouncer  client = download_manager.getTrackerClient();
   
    if ( client != null ){
     
      client.resetTrackerUrl(true);
    }
  }
View Full Code Here

  {
    download_manager.requestTrackerScrape( immediate );
  }
 
  public byte[] getDownloadPeerId() {
    TRTrackerAnnouncer announcer = download_manager.getTrackerClient();
    if(announcer == null) return null;
    return announcer.getPeerId();
  }
View Full Code Here

              // o = none, 1=tracker warn,2=tracker error,2=other
            if ( str != null && str.length() > 0 ){
              value = new Long(3);
            }else{
              value = ZERO;
              TRTrackerAnnouncer tracker_client = core_download.getTrackerClient();
             
              if ( tracker_client != null ){
                TRTrackerAnnouncerResponse x = tracker_client.getBestAnnouncer().getLastResponse();
                if ( x != null ){
                  if ( x.getStatus() == TRTrackerAnnouncerResponse.ST_REPORTED_ERROR ){
                    value = new Long(2);
                  }
                }
              }else{
                DownloadScrapeResult x = download.getLastScrapeResult();
                if ( x != null ){
                  if ( x.getResponseType() == DownloadScrapeResult.RT_ERROR ){
                    String status = x.getStatus();
                   
                    if ( status != null && status.length() > 0 ){
                   
                      value = new Long(2);
                    }
                  }
                }
              }
            }
          }else if ( field.equals( "errorString" )){ 
            String str = download.getErrorStateDetails();
           
            if ( str != null && str.length() > 0 ){
              value = str;
            }else{
              value = "";
              TRTrackerAnnouncer tracker_client = core_download.getTrackerClient();
             
              if ( tracker_client != null ){
                TRTrackerAnnouncerResponse x = tracker_client.getBestAnnouncer().getLastResponse();
                if ( x != null ){
                  if ( x.getStatus() == TRTrackerAnnouncerResponse.ST_REPORTED_ERROR ){
                    value = x.getStatusString();
                  }
                }
View Full Code Here

  protected boolean performCommand(ConsoleInput ci, DownloadManager dm, List args) {
    TOTorrent torrent = dm.getTorrent();
        if (torrent != null) {
          try {
          TRHost  host = ci.azureus_core.getTrackerHost();
         
          TRHostTorrent  existing = host.getHostTorrent( torrent );
         
          if ( existing == null ){
           
            host.publishTorrent(torrent);
          }else{
            try{
              existing.remove();
             
            }catch( Throwable e ){
View Full Code Here

TOP

Related Classes of org.gudy.azureus2.core3.tracker.client.TRTrackerAnnouncer

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.