Package com.aelitis.azureus.core.peermanager.piecepicker.util

Examples of com.aelitis.azureus.core.peermanager.piecepicker.util.BitFlags


      }
    } else {
      gcImage = new GC(image);
    }

    final BitFlags peerHave = infoObj.getAvailable();
    boolean established = ((PEPeerTransport)infoObj).getConnectionState() == PEPeerTransport.CONNECTION_FULLY_ESTABLISHED;
   
    if (established && peerHave != null && peerHave.flags.length > 0) {
      if (imageBuffer == null || imageBuffer.length != drawWidth) {
        imageBuffer = new int[drawWidth];
View Full Code Here


    try{
      closing_mon.enter();
     
      if ( !closing ){
     
        final BitFlags tempHavePieces;
       
        if ( peerHavePieces ==null ){
       
          tempHavePieces = new BitFlags(nbPieces);
         
        }else{
       
          tempHavePieces = peerHavePieces;
         
          removeAvailability();
        }
       
        tempHavePieces.setAll();
       
        for ( int i=0; i<nbPieces; i++ ){
         
          manager.updateSuperSeedPiece( this, i );
        }
View Full Code Here

    try{
      closing_mon.enter();
     
      if ( !closing ){
     
        final BitFlags tempHavePieces;
       
        if ( peerHavePieces ==null ){
       
          tempHavePieces = new BitFlags(nbPieces);
         
        }else{
       
          tempHavePieces = peerHavePieces;
         
          removeAvailability();
        }
       
        tempHavePieces.clear();
       
        peerHavePieces = tempHavePieces;
       
          //some of these kinda pointless but whatever
       
View Full Code Here

      closing_mon.enter();
      if (closing)
        bitfield.destroy();
      else
      {
        final BitFlags tempHavePieces;
        if (peerHavePieces ==null)
        {
          tempHavePieces =new BitFlags(nbPieces);
        } else
        {
          tempHavePieces =peerHavePieces;
          removeAvailability();
        }
        for (int i =0; i <nbPieces; i++)
        {
          final int index =i /8;
          final int bit =7 -(i %8);
          final byte bData =dataf[index];
          final byte b =(byte) (bData >>bit);
          if ((b &0x01) ==1)
          {
            tempHavePieces.set(i);
            manager.updateSuperSeedPiece(this,i);
          }
        }

        bitfield.destroy();
View Full Code Here

    if (closing)
      return;

    if (peerHavePieces ==null)
      peerHavePieces =new BitFlags(nbPieces);

    if (!peerHavePieces.flags[pieceNumber])
    {
      if (!interested_in_other_peer &&diskManager.isInteresting(pieceNumber))
      {
View Full Code Here

            return;
        }
       
        if ( peerHavePieces == null ){
         
            peerHavePieces = new BitFlags( nbPieces );
        }
       
        boolean  send_interested = false;
        boolean  new_have    = false;
              
View Full Code Here

         
          calculatePiecePriorities();
        }
      }
   
      BitFlags flags = peerHavePieces;
   
      if ( flags != null && flags.nbSet >= ALLOWED_FAST_OTHER_PEER_PIECE_MAX ){
       
        int[][] pieces = (int[][])getUserData( KEY_ALLOWED_FAST_SENT );
View Full Code Here

  {
    boolean[]  flags = foreign.getAvailable();
   
    if ( bit_flags == null || bit_flags.flags != flags ){
     
      bit_flags = new BitFlags( flags );
    }
   
    return( bit_flags );
  }
View Full Code Here

              Integer[] d = (Integer[])data;
              l.sentBadChunk(self, d[0].intValue(), d[1].intValue() );
              break;
            }
            case PeerEvent.ET_ADD_AVAILABILITY:{
              l.addAvailability(self, new BitFlags((boolean[])data));
              break;
            }
            case PeerEvent.ET_REMOVE_AVAILABILITY:{
              l.removeAvailability(self, new BitFlags((boolean[])data));
              break;
            }
          }
        } 
      };
View Full Code Here

    //get the peer connection
      final PEPeer peer =(PEPeerTransport)peers.get(i);
      if (peer !=null &&peer.getPeerState() ==PEPeer.TRANSFERING)
      {
        //cycle trhough the pieces they actually have
        final BitFlags peerHavePieces =peer.getAvailable();
        if (peerHavePieces !=null &&peerHavePieces.nbSet >0)
        {
          for (j =peerHavePieces.start; j <=peerHavePieces.end; j++)
          {
            if (peerHavePieces.flags[j])
View Full Code Here

TOP

Related Classes of com.aelitis.azureus.core.peermanager.piecepicker.util.BitFlags

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.