1
0
mirror of https://github.com/Rogiel/torrent4j synced 2025-12-06 07:32:47 +00:00

Fixes compiling issue

This commit is contained in:
2013-12-18 19:23:48 -02:00
parent 749c2c9558
commit 0c8121c57b
3 changed files with 28 additions and 33 deletions

View File

@@ -6,5 +6,13 @@ package com.torrent4j.model.peer;
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public enum TorrentPeerInterest {
INTERESTED, NOT_INTERESTED;
/**
* Determines that the peer is interest in any piece from the other peer.
*/
INTERESTED,
/**
* Determines that the peer is NOT interest in any piece from the other peer.
*/
NOT_INTERESTED;
}

View File

@@ -3,11 +3,26 @@ package com.torrent4j.model.peer;
import java.util.BitSet;
import com.torrent4j.model.AbstractTorrentPiecesContainer;
import com.torrent4j.net.peerwire.messages.BitFieldMessage;
import com.torrent4j.net.peerwire.messages.HaveMessage;
/**
* This class represents a set of pieces that a given peer has on their side.
* Please note that some peers make use of a delayed bitfield, which sets random
* pieces of the bitfield set on {@link BitFieldMessage} and the rest is
* received with {@link HaveMessage}s. This is called "lazy bitfield".
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class TorrentPeerPieces extends AbstractTorrentPiecesContainer {
private final TorrentPeer peer;
/**
* Loads an existing bitset to this container
*
* @param bitSet
* the bitset
*/
public void load(BitSet bitSet) {
this.bitSet.set(0, this.bitSet.size(), false);
for (int i = bitSet.nextSetBit(0); i >= 0; i = bitSet.nextSetBit(i + 1)) {