Example #1
0
  /** We now have this piece. Tell the peer and cancel any requests for the piece. */
  void havePiece(int piece) {
    if (_log.shouldLog(Log.DEBUG)) _log.debug("Tell " + peer + " havePiece(" + piece + ")");

    // Tell the other side that we are no longer interested in any of
    // the outstanding requests for this piece.
    cancelPiece(piece);

    // Tell the other side that we really have this piece.
    out.sendHave(piece);

    // Request something else if necessary.
    addRequest();

    /**
     * ** taken care of in addRequest() synchronized(this) { // Is the peer still interesting? if
     * (lastRequest == null) setInteresting(false); } **
     */
  }
Example #2
0
File: Peer.java Project: hilbix/i2p
 /**
  * Tell the other side that we are no longer interested in any of the outstanding requests (if
  * any) for this piece.
  *
  * @since 0.8.1
  */
 void cancel(int piece) {
   PeerState s = state;
   if (s != null) s.cancelPiece(piece);
 }