コード例 #1
0
        public void messageSent(Message message) {
          if (message.getID().equals(BTMessage.ID_BT_PIECE)) {
            try {
              lock_mon.enter();

              // due to timing issues we can get in here with a message already removed

              queued_messages.remove(message);

            } finally {
              lock_mon.exit();
            }

            /*
            if ( peer.getIp().equals( "64.71.5.2" )){

            	outgoing_message_queue.setTrace( true );

            	// BTPiece p = (BTPiece)message;

            	// TimeFormatter.milliTrace( "obt sent: " + p.getPieceNumber() + "/" + p.getPieceOffset());
            }
            */

            doReadAheadLoads();
          }
        }
コード例 #2
0
        public void messageQueued(Message message) {
          // if another message is going to be sent anyway, add our haves as well

          String message_id = message.getID();

          if (!(message_id.equals(BTMessage.ID_BT_HAVE)
              || message_id.equals(AZMessage.ID_AZ_HAVE))) {
            sendPendingHaves();
          }
        }