Method | Description | |
---|---|---|
AddOrUpdateCachedPeerChunkFlags ( ConnectionInfo connectionInfo, |
Adds or updates a peer to the local availability list. Useful for when a peer informs us of an updated availability.
|
|
AllPeerEndPoints ( ) : string[] |
Returns an array containing all known peer endpoints in the format locaIP:port
|
|
AllPeerIdentifiers ( ) : string[] |
Returns an array containing the network identifiers of every peer in this swarm
|
|
BroadcastItemRemoval ( string itemCheckSum, bool removeSwarmWide ) : void |
Broadcast to all known peers that the local DFS is removing the specified item.
|
|
BroadcastLocalAvailability ( string itemCheckSum ) : void |
Updates all peers in the swarm that we have updated a chunk
|
|
CachedNonLocalChunkExistences ( byte totalChunksInItem, PeerInfo>.Dictionary |
Builds a dictionary of chunk availability throughout the current swarm for chunks we don't have locally. Keys are chunkIndex, peer network identifier, and peer total chunk count
|
|
ChunkHealthMetric ( byte chunkIndex, byte totalNumChunks ) : double |
Metric used to determine the health of a chunk and whether swarm will benefit from a broadcasted update. A value greater than 1 signifies a healthy chunk availability.
|
|
ClearAllLocalAvailabilityFlags ( ) : void |
Clear all chunk availability flags for the local peer
|
|
CloseConnectionsToCompletedPeers ( byte totalNumChunks ) : void |
Closes established connections with completed peers as they are now redundant.
|
|
GetNewTimeoutCount ( |
Returns the new timeout count value after incrementing the timeout count for the provided peer IPEndPoint.
|
|
IPEndPointBusy ( |
Get the provided peer IPEndPoint busy status
|
|
IPEndPointOnline ( |
Get the provided peer IPEndPoint online status
|
|
NumCompletePeersInSwarm ( byte totalItemChunks, bool excludeSuperPeers = false ) : int |
The number of complete peers in this swarm.
|
|
NumPeersInSwarm ( bool excludeSuperPeers = false ) : int |
The number of peers in this swarm
|
|
PeerChunkAvailability ( |
Returns the chunk flag availability of the requested peer.
|
|
PeerContactAllowed ( |
Single method for determining if contact can be made with the request peer. Prevents loop back contact via matching identifier and currentLocalListenEndPoints. Finally uses the DFS.AllowedPeerIPS and DFS.DisallowedPeerIPS if set.
|
|
PeerExistsInSwarm ( |
Returns true if a peer with the provided IPEndPoint exists in the swarm
|
|
PeerExistsInSwarm ( |
Returns true if a peer with the provided networkIdentifier exists in this SwarmChunkAvailability
|
|
PeerHasChunk ( |
Returns true if the specified peer has the specified chunkIndex.
|
|
PeerIsComplete ( |
Returns true if a peer has a complete copy of the DFS item
|
|
PeerIsSuperPeer ( |
Returns true if the specified peer is a super peer
|
|
RecordLocalChunkCompletion ( byte chunkIndex ) : void |
Records a chunk as available for the local peer
|
|
RemoveOldPeerAtEndPoint ( |
Removes any peers which have the same endPoint as the provided currentActivePeerEndPoint except one with matching currentActivePeerIdentifier
|
|
RemovePeerIPEndPointFromSwarm ( |
Deletes knowledge of a peer IPEndPoint from our local swarm chunk availability. If peerEndPoint.Address is IPAddress.Any then the entire peer will be deleted.
|
|
SetIPEndPointBusy ( |
Set the provided peer IPEndPoint busy status to busy
|
|
SetIPEndPointOffline ( |
Set the provided peer IPEndPoint as offline
|
|
SetLocalChunkFlag ( byte chunkIndex, bool setAvailable ) : void |
Sets our local availability
|
|
SwarmChunkAvailability ( List |
Creates a new instance of SwarmChunkAvailability
|
|
ThreadSafeSerialise ( ) : byte[] |
Serialise this swarm chunk availability in a thread safe manner
|
|
UpdatePeerAvailability ( string itemCheckSum, int cascadeDepth, int responseWaitMS = 5000, Action |
Update the chunk availability by contacting all existing peers. If a cascade depth greater than 1 is provided will also contact each peers peers.
|
Method | Description | |
---|---|---|
AfterSerialise ( ) : void | ||
BeforeSerialise ( ) : void | ||
SwarmChunkAvailability ( ) : System |
Blank constructor used for serialisation
|
public AddOrUpdateCachedPeerChunkFlags ( ConnectionInfo connectionInfo, |
||
connectionInfo | ConnectionInfo | The connectionInfo of the remote peer |
latestChunkFlags | The new chunk flags | |
superPeer | bool | True if this peer is a superPeer |
setIPEndPointOnline | bool | Set the relevant IPEndPoint online as a result of updating chunk flags |
return | void |
public BroadcastItemRemoval ( string itemCheckSum, bool removeSwarmWide ) : void | ||
itemCheckSum | string | The checksum associated with this item |
removeSwarmWide | bool | True if the item should be removed by all peers, swarm wide |
return | void |
public BroadcastLocalAvailability ( string itemCheckSum ) : void | ||
itemCheckSum | string | The checksum associated with this item |
return | void |
public CachedNonLocalChunkExistences ( byte totalChunksInItem, PeerInfo>.Dictionary |
||
totalChunksInItem | byte | The total number of chunks in this item |
nonLocalPeerAvailability | PeerInfo>.Dictionary | A quick reference dictionary for matching ConnectionInfo with PeerInfo |
return | Dictionary |
public ChunkHealthMetric ( byte chunkIndex, byte totalNumChunks ) : double | ||
chunkIndex | byte | The relevant chunk index |
totalNumChunks | byte | The total number of chunks in this item |
return | double |
public ClearAllLocalAvailabilityFlags ( ) : void | ||
return | void |
public CloseConnectionsToCompletedPeers ( byte totalNumChunks ) : void | ||
totalNumChunks | byte | The total number of chunks in this item |
return | void |
public GetNewTimeoutCount ( |
||
networkIdentifier | The network identifier of the relevant peer | |
peerIPEndPoint | The relevant IPEndPoint | |
return | int |
public IPEndPointBusy ( |
||
networkIdentifier | The network identifier of the relevant peer | |
peerIPEndPoint | The relevant IPEndPoint | |
return | bool |
public IPEndPointOnline ( |
||
networkIdentifier | The network identifier of the relevant peer | |
peerIPEndPoint | The relevant IPEndPoint | |
return | bool |
public NumCompletePeersInSwarm ( byte totalItemChunks, bool excludeSuperPeers = false ) : int | ||
totalItemChunks | byte | The total number of chunks in this item |
excludeSuperPeers | bool | True if super peers should be excluded from the count. |
return | int |
public NumPeersInSwarm ( bool excludeSuperPeers = false ) : int | ||
excludeSuperPeers | bool | True if super peers should be excluded from the count. |
return | int |
public PeerChunkAvailability ( |
||
peerIdentifier | The relevant network identifier | |
return |
public PeerContactAllowed ( |
||
peerIdentifier | The relevant network identifier | |
peerEndPoint | The relevant IPEndPoint | |
superPeer | bool | True if this peer is a super peer |
return | bool |
public PeerExistsInSwarm ( |
||
peerIPEndPoint | The relevant IPEndPoint | |
return | bool |
public PeerExistsInSwarm ( |
||
networkIdentifier | The network identifier of the relevant peer | |
return | bool |
public PeerHasChunk ( |
||
networkIdentifier | The network identifier of the relevant peer | |
chunkIndex | byte | The desired chunkIndex |
return | bool |
public PeerIsComplete ( |
||
networkIdentifier | The network identifier of the relevant peer | |
totalNumChunks | byte | The total number of chunks in this item |
return | bool |
public PeerIsSuperPeer ( |
||
networkIdentifier | The network identifier of the relevant peer | |
return | bool |
public RecordLocalChunkCompletion ( byte chunkIndex ) : void | ||
chunkIndex | byte | The relevant chunkIndex |
return | void |
public RemoveOldPeerAtEndPoint ( |
||
currentActivePeerIdentifier | The NetworkIdenfier of the known active peer | |
currentActivePeerEndPoint | The endPoint of the known active peer | |
return | void |
public RemovePeerIPEndPointFromSwarm ( |
||
networkIdentifier | The network identifier of the relevant peer | |
peerEndPoint | The relevant IPEndPoint | |
forceRemoveWholePeer | bool | If true every IPEndPoint is removed for the provided network identifier |
return | void |
public SetIPEndPointBusy ( |
||
networkIdentifier | The network identifier of the relevant peer | |
peerIPEndPoint | The relevant IPEndPoint | |
return | void |
public SetIPEndPointOffline ( |
||
networkIdentifier | The network identifier of the relevant peer | |
peerIPEndPoint | The relevant IPEndPoint | |
return | void |
public SetLocalChunkFlag ( byte chunkIndex, bool setAvailable ) : void | ||
chunkIndex | byte | The chunk index flag to update |
setAvailable | bool | The availability of the provided chunk |
return | void |
public SwarmChunkAvailability ( List |
||
sourceConnectionInfoList | List |
A list of sources. Possibly multiple peers each with multiple IPEndPoints. |
totalNumChunks | byte | The total number of chunks in the associated DFS item, used for initialising peer chunkflags |
return | System |
public UpdatePeerAvailability ( string itemCheckSum, int cascadeDepth, int responseWaitMS = 5000, Action |
||
itemCheckSum | string | The checksum associated with this item. This will be used when contacting other peers /// for an update. |
cascadeDepth | int | The depth of the update cascade. 0 - Contact only known peers for an update. 1 - Contact /// known peers and retrieve their known peers as well. >1 - Not implemented. |
responseWaitMS | int | The maximum time to wait for the first update reply to be received before continuing. |
buildLog | Action |
An optional build log that can be updated with the progress of this method. |
return | void |