Interface IPiecePicker
Namespace: MonoTorrent.Client.PiecePicking
Assembly: MonoTorrent.dll
Syntax
public interface IPiecePicker
Methods
AbortRequests(IPeer)
Cancel all unreceived requests. No further blocks will be requested from this peer.
Declaration
int AbortRequests(IPeer peer)
Parameters
| Type | Name | Description |
|---|---|---|
| IPeer | peer | The peer whose requests will be cancelled. |
Returns
| Type | Description |
|---|---|
| System.Int32 | The number of requests which were cancelled |
CancelRequests(IPeer, Int32, Int32)
Cancel all unreceived requests between startIndex and endIndex.
Declaration
IList<BlockInfo> CancelRequests(IPeer peer, int startIndex, int endIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| IPeer | peer | The peer to request the block from |
| System.Int32 | startIndex | The lowest piece index to consider |
| System.Int32 | endIndex | The highest piece index to consider |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IList<BlockInfo> | The list of requests which were cancelled |
ContinueAnyExistingRequest(IPeer, Int32, Int32, Int32)
Request any unrequested block from a piece owned by this peer, or any other peer, within the specified bounds.
Declaration
BlockInfo? ContinueAnyExistingRequest(IPeer peer, int startIndex, int endIndex, int maxDuplicateRequests)
Parameters
| Type | Name | Description |
|---|---|---|
| IPeer | peer | The peer to request the block from |
| System.Int32 | startIndex | The lowest piece index to consider |
| System.Int32 | endIndex | The highest piece index to consider |
| System.Int32 | maxDuplicateRequests | The maximum number of concurrent duplicate requests |
Returns
| Type | Description |
|---|---|
| System.Nullable<BlockInfo> |
ContinueExistingRequest(IPeer, Int32, Int32)
Request the next unrequested block from a piece owned by this peer, within the specified bounds.
Declaration
BlockInfo? ContinueExistingRequest(IPeer peer, int startIndex, int endIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| IPeer | peer | The peer to request the block from |
| System.Int32 | startIndex | The lowest piece index to consider |
| System.Int32 | endIndex | The highest piece index to consider |
Returns
| Type | Description |
|---|---|
| System.Nullable<BlockInfo> |
CurrentReceivedCount()
Returns the number of blocks which have been received f pieces currently being requested.
Declaration
int CurrentReceivedCount()
Returns
| Type | Description |
|---|---|
| System.Int32 |
CurrentRequestCount()
Returns the number of pieces currently being requested.
Declaration
int CurrentRequestCount()
Returns
| Type | Description |
|---|---|
| System.Int32 |
ExportActiveRequests()
Returns a list of all
Declaration
IList<ActivePieceRequest> ExportActiveRequests()
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IList<ActivePieceRequest> |
Initialise(ITorrentData)
Reset all internal state. Called after StartAsync() or StopAsync() is invoked.
Declaration
void Initialise(ITorrentData torrentData)
Parameters
| Type | Name | Description |
|---|---|---|
| ITorrentData | torrentData |
IsInteresting(IPeer, BitField)
Declaration
bool IsInteresting(IPeer peer, BitField bitfield)
Parameters
| Type | Name | Description |
|---|---|---|
| IPeer | peer | |
| BitField | bitfield |
Returns
| Type | Description |
|---|---|
| System.Boolean |
PickPiece(IPeer, BitField, IReadOnlyList<IPeer>, Int32, Int32, Int32)
Declaration
IList<BlockInfo> PickPiece(IPeer peer, BitField available, IReadOnlyList<IPeer> otherPeers, int count, int startIndex, int endIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| IPeer | peer | |
| BitField | available | |
| System.Collections.Generic.IReadOnlyList<IPeer> | otherPeers | |
| System.Int32 | count | |
| System.Int32 | startIndex | |
| System.Int32 | endIndex |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IList<BlockInfo> |
RequestRejected(IPeer, BlockInfo)
Called when a MonoTorrent.Client.Messages.FastPeer.RejectRequestMessage is received from the peer to indicate
the BlockInfo will not be fulfilled.
Declaration
void RequestRejected(IPeer peer, BlockInfo request)
Parameters
| Type | Name | Description |
|---|---|---|
| IPeer | peer | |
| BlockInfo | request |
ValidatePiece(IPeer, BlockInfo, out Boolean, out IList<IPeer>)
Called when a MonoTorrent.Client.Messages.Standard.PieceMessage is received from the peer. Returns true if the
piece was requested from this peer and should be accepted, otherwise returns false if the piece was not requested from this peer and should
be discarded.
Declaration
bool ValidatePiece(IPeer peer, BlockInfo request, out bool pieceComplete, out IList<IPeer> peersInvolved)
Parameters
| Type | Name | Description |
|---|---|---|
| IPeer | peer | |
| BlockInfo | request | |
| System.Boolean | pieceComplete | True if this was the final block for the piece |
| System.Collections.Generic.IList<IPeer> | peersInvolved | When |
Returns
| Type | Description |
|---|---|
| System.Boolean |