Package org.gudy.azureus2.core3.peer

Examples of org.gudy.azureus2.core3.peer.PEPeerManager$StatsReceiver


      piecesImage = new Image(SWTThread.getInstance().getDisplay(), newWidth, newHeight);
      final GC gcImage = new GC(piecesImage);
     
      // dm may be null if this is a skeleton file view
      DownloadManager download_manager = fileInfo.getDownloadManager();
      PEPeerManager peer_manager = download_manager == null ? null : download_manager.getPeerManager();
      PEPiece[] pe_pieces = peer_manager == null ? null : peer_manager.getPieces();
      final long now = SystemTime.getCurrentTime();
     
      if (fileInfo != null && manager != null)
      {
        if (percentDone == 1000)
View Full Code Here


     
      return;
    }
   
    DiskManager    disk_manager = download_manager.getDiskManager();
    PEPeerManager  peer_manager = download_manager.getPeerManager();

    if (disk_manager == null || peer_manager == null ){
     
      return;
    }
   
    DiskManagerPiece[]   dm_pieces = disk_manager.getPieces();
    PEPiece[]      pe_pieces = peer_manager.getPieces();
   
    int  first_piece = file.getFirstPieceNumber();
    int  num_pieces  = file.getNbPieces();
   
    int iNumCols = bounds.width / BLOCK_SIZE;
 
    int  x_block = x/BLOCK_SIZE;
    int  y_block = y/BLOCK_SIZE;
   
    int  piece_number = y_block*iNumCols + x_block + first_piece;
   
    if ( piece_number >= first_piece && piece_number < first_piece + num_pieces ){
     
      DiskManagerPiece  dm_piece = dm_pieces[piece_number];
      PEPiece        pe_piece = pe_pieces[piece_number];
     
      String  text =  "Piece " + piece_number + ": " + dm_piece.getString();
     
      if ( pe_piece != null ){
       
        text += ", active: " + pe_piece.getString();

      }else{
       
        if ( dm_piece.isNeeded() && !dm_piece.isDone()){
         
          text += ", inactive: " + peer_manager.getPiecePicker().getPieceString( piece_number );
        }
      }
     
      topLabel.setText( text );
     
View Full Code Here

    }

    DownloadManager  download_manager = file==null?null:file.getDownloadManager();
   
    DiskManager    disk_manager = download_manager==null?null:download_manager.getDiskManager();
    PEPeerManager  peer_manager = download_manager==null?null:download_manager.getPeerManager();
   
    if ( file == null || disk_manager == null || peer_manager == null ) {
      GC gc = new GC(fileInfoCanvas);
      gc.fillRectangle(bounds);
      gc.dispose();

      return;
    }

    int  first_piece = file.getFirstPieceNumber();
    int  num_pieces  = file.getNbPieces();
   
    int iNumCols = bounds.width / BLOCK_SIZE;
    int iNeededHeight = (((num_pieces - 1) / iNumCols) + 1)
        * BLOCK_SIZE;
    if (sc.getMinHeight() != iNeededHeight) {
      sc.setMinHeight(iNeededHeight);
      sc.layout(true, true);
      bounds = fileInfoCanvas.getClientArea();
    }

    img = new Image(fileInfoCanvas.getDisplay(), bounds.width, iNeededHeight);
    GC gcImg = new GC(img);

    try {
      gcImg.setBackground(fileInfoCanvas.getBackground());
      gcImg.fillRectangle(0, 0, bounds.width, bounds.height);


      DiskManagerPiece[]   dm_pieces = disk_manager.getPieces();
      PEPiece[]      pe_pieces = peer_manager.getPieces();

      int iRow = 0;
      int iCol = 0;
     
      for (int i = first_piece; i < first_piece+num_pieces; i++) {
View Full Code Here

  {
    needsSaving = true//make sure we update 'downloads.config' on state changes

    //run seeding-only-mode check

    PEPeerManager  pm_manager = manager.getPeerManager();

    if (   new_state == DownloadManager.STATE_DOWNLOADING &&
        pm_manager != null &&
        pm_manager.hasDownloadablePiece()){

      //the new state is downloading, so can skip the full check

      setSeedingOnlyState( false, false );
View Full Code Here

   
    for( int i=0; i < managers.size(); i++ ) {
       
        DownloadManager dm = (DownloadManager)managers.get( i );

        PEPeerManager pm = dm.getPeerManager();
       
        int  state = dm.getState();

        if ( dm.getDiskManager() == null || pm == null ){
         
            // download not running
         
          if ( state == DownloadManager.STATE_QUEUED ){
            
            if ( dm.isDownloadComplete( false )){
             
              potentially_seeding = true;
            } else {

              // Queued and Incomplete means we aren't "only seeding".  This
              // download WILL start, it just hasn't yet for various reasons
              // (1st Priority, etc)
              seeding       = false;
             
              // can't break out, because we still need to calculate
              // potentially_seeding.  Set a flag so we don't set "seeding"
              // back to true
              seeding_set = true;

            }
          }
         
          continue;
        }
       
        if ( state == DownloadManager.STATE_DOWNLOADING ){
         
          if (!pm.hasDownloadablePiece()){
           
              // complete DND file

            if (!seeding_set) {
             
View Full Code Here

   
    long  mono_now = SystemTime.getMonotonousTime();
   
    for ( Map.Entry<PEPeerManager, PMState> entry: pm_map.entrySet()){
     
      PEPeerManager  pm     = entry.getKey();
      PMState      state   = entry.getValue();
     
      boolean  is_complete = !pm.hasDownloadablePiece();
     
      PEPeerManagerStats pm_stats = pm.getStats();
 
      long  up_bytes = pm_stats.getTotalDataBytesSentNoLan() + pm_stats.getTotalProtocolBytesSentNoLan();
           
      long  diff = state.setBytesUp( up_bytes );
     
      if ( is_complete ){
               
        num_complete++;
       
        c_up_total += diff;
       
      }else{
               
        num_incomplete++;
       
        i_up_total += diff;
       
        if ( state.isInteresting( mono_now )){
         
          num_interesting++;
        }
      }
       
      if ( state.isComplete() != is_complete ){
     
        if ( is_complete ){
         
          pm.addRateLimiter( limiter, true );
         
        }else{
         
          pm.removeRateLimiter( limiter, true );
        }
       
        state.setComplete( is_complete );
      }
    }
View Full Code Here

 
 
  public int
  getNbSeeds()
  {
    PEPeerManager peerManager = controller.getPeerManager();
   
    if (peerManager != null){
     
      return peerManager.getNbSeeds();
    }
   
    return 0;
  }
View Full Code Here

  }

  public int
  getNbPeers()
  {
    PEPeerManager peerManager = controller.getPeerManager();

    if (peerManager != null){
   
      return peerManager.getNbPeers();
    }
   
    return 0;
  }
View Full Code Here

      for (int i=0;i<current_peers.size();i++){
       
        peer_listeners.dispatch( listener, LDT_PE_PEER_ADDED, current_peers.get(i));
      }
       
      PEPeerManager  temp = controller.getPeerManager();
   
      if ( temp != null ){
 
        peer_listeners.dispatch( listener, LDT_PE_PM_ADDED, temp );
      }
View Full Code Here

  public int
  getHealthStatus()
  {
    int  state = getState();
   
    PEPeerManager  peerManager   = controller.getPeerManager();
   
    TRTrackerAnnouncer tc = getTrackerClient();
   
    if( tc != null && peerManager != null && (state == STATE_DOWNLOADING || state == STATE_SEEDING)) {
     
      int nbSeeds = getNbSeeds();
      int nbPeers = getNbPeers();
      int nbRemotes = peerManager.getNbRemoteTCPConnections();
     
      TRTrackerAnnouncerResponse  announce_response = tc.getLastResponse();
     
      int trackerStatus = announce_response.getStatus();
     
View Full Code Here

TOP

Related Classes of org.gudy.azureus2.core3.peer.PEPeerManager$StatsReceiver

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.