C# Class DistributedFileSystem.PeerInfo

Show file Open project: MarcFletcher/NetworkComms.Net

Private Properties

Property Type Description
AfterSerialise void
BeforeSerialise void
PeerInfo System
ValidateNetworkIdentifier void

Public Methods

Method Description
AddPeerIPEndPoint ( ShortGuid networkIdentifier, IPEndPoint peerIPEndPoint ) : bool

Add new IPEndPoint for a peer. Returns true if successfully added, otherwise false.

CheckAllIPEndPointBusyFlags ( int msSinceBusyToClear ) : void

Clear any busy flags set for the IPEndPoints of this peer if they are older than the provided MS

GetConnectionInfo ( ) : List

Returns a new list containing all peer ConnectionInfos

GetCurrentTimeoutCount ( ShortGuid networkIdentifier, IPEndPoint peerIPEndPoint ) : int

Return the current timeout count value.

GetNewTimeoutCount ( ShortGuid networkIdentifier, IPEndPoint peerIPEndPoint ) : int

Returns the new timeout count value after incrementing the timeout count.

HasAtleastOneOnlineIPEndPoint ( ) : bool

Returns true if this peer has at least one on line ipEndPoint

IsPeerIPEndPointBusy ( ShortGuid networkIdentifier, IPEndPoint peerIPEndPoint ) : bool

Returns the current busy status of the requested peer IPEndPoint

IsPeerIPEndPointOnline ( ShortGuid networkIdentifier, IPEndPoint peerIPEndPoint ) : bool

Returns true if the specified peer has the specified IPEndPoint online.

PeerContainsIPEndPoint ( ShortGuid networkIdentifier, IPEndPoint peerIPEndPoint ) : bool

Returns true if the provided IPEndPoint exists for this peer

PeerInfo ( List peerConnectionInfo, ChunkFlags peerChunkFlags, bool superPeer ) : System

Initialise a new PeerInfo

RemovePeerIPEndPoint ( ConnectionInfo connectionInfo ) : bool

Removes the provided connectionInfo from all internal dictionaries. Returns true if connectionInfo exists, otherwise false

RemovePeerIPEndPoint ( ShortGuid networkIdentifier, IPEndPoint peerIPEndPoint ) : bool

Removes the provided connectionInfo from all internal dictionaries. Returns true if connectionInfo exists, otherwise false

SetPeerIPEndPointBusyStatus ( ShortGuid networkIdentifier, IPEndPoint peerIPEndPoint, bool busyStatus ) : void

Update the provided peer IPEndPoint busy status

SetPeerIPEndPointOnlineStatus ( ShortGuid networkIdentifier, IPEndPoint peerIPEndPoint, bool onlineStatus ) : void

Update the provided peer IPEndPoint online status

ToString ( ) : string

Returns a clean descriptor for this PeerInfo

Private Methods

Method Description
AfterSerialise ( ) : void
BeforeSerialise ( ) : void
PeerInfo ( ) : System
ValidateNetworkIdentifier ( ConnectionInfo connectionInfo ) : void

A private method which checks the provided network identifier with that expected.

Method Details

AddPeerIPEndPoint() public method

Add new IPEndPoint for a peer. Returns true if successfully added, otherwise false.
public AddPeerIPEndPoint ( ShortGuid networkIdentifier, IPEndPoint peerIPEndPoint ) : bool
networkIdentifier NetworkCommsDotNet.Tools.ShortGuid The network identifier of the relevant peer
peerIPEndPoint System.Net.IPEndPoint The relevant IPEndPoint
return bool

CheckAllIPEndPointBusyFlags() public method

Clear any busy flags set for the IPEndPoints of this peer if they are older than the provided MS
public CheckAllIPEndPointBusyFlags ( int msSinceBusyToClear ) : void
msSinceBusyToClear int Milliseconds since busy flag was set to clear
return void

GetConnectionInfo() public method

Returns a new list containing all peer ConnectionInfos
public GetConnectionInfo ( ) : List
return List

GetCurrentTimeoutCount() public method

Return the current timeout count value.
public GetCurrentTimeoutCount ( ShortGuid networkIdentifier, IPEndPoint peerIPEndPoint ) : int
networkIdentifier NetworkCommsDotNet.Tools.ShortGuid The network identifier of the relevant peer
peerIPEndPoint System.Net.IPEndPoint The relevant IPEndPoint
return int

GetNewTimeoutCount() public method

Returns the new timeout count value after incrementing the timeout count.
public GetNewTimeoutCount ( ShortGuid networkIdentifier, IPEndPoint peerIPEndPoint ) : int
networkIdentifier NetworkCommsDotNet.Tools.ShortGuid The network identifier of the relevant peer
peerIPEndPoint System.Net.IPEndPoint The relevant IPEndPoint
return int

HasAtleastOneOnlineIPEndPoint() public method

Returns true if this peer has at least one on line ipEndPoint
public HasAtleastOneOnlineIPEndPoint ( ) : bool
return bool

IsPeerIPEndPointBusy() public method

Returns the current busy status of the requested peer IPEndPoint
public IsPeerIPEndPointBusy ( ShortGuid networkIdentifier, IPEndPoint peerIPEndPoint ) : bool
networkIdentifier NetworkCommsDotNet.Tools.ShortGuid The network identifier of the relevant peer
peerIPEndPoint System.Net.IPEndPoint The relevant IPEndPoint
return bool

IsPeerIPEndPointOnline() public method

Returns true if the specified peer has the specified IPEndPoint online.
public IsPeerIPEndPointOnline ( ShortGuid networkIdentifier, IPEndPoint peerIPEndPoint ) : bool
networkIdentifier NetworkCommsDotNet.Tools.ShortGuid The network identifier of the peer to check
peerIPEndPoint System.Net.IPEndPoint The IPEndPoint of the peer to check
return bool

PeerContainsIPEndPoint() public method

Returns true if the provided IPEndPoint exists for this peer
public PeerContainsIPEndPoint ( ShortGuid networkIdentifier, IPEndPoint peerIPEndPoint ) : bool
networkIdentifier NetworkCommsDotNet.Tools.ShortGuid The network identifier of the relevant peer
peerIPEndPoint System.Net.IPEndPoint The relevant IPEndPoint
return bool

PeerInfo() public method

Initialise a new PeerInfo
public PeerInfo ( List peerConnectionInfo, ChunkFlags peerChunkFlags, bool superPeer ) : System
peerConnectionInfo List All ConnectionInfos corresponding with this peer
peerChunkFlags ChunkFlags The initial ChunkFlags for this peer
superPeer bool True if this is a SuperPeer
return System

RemovePeerIPEndPoint() public method

Removes the provided connectionInfo from all internal dictionaries. Returns true if connectionInfo exists, otherwise false
public RemovePeerIPEndPoint ( ConnectionInfo connectionInfo ) : bool
connectionInfo ConnectionInfo The connectionInfo to remove
return bool

RemovePeerIPEndPoint() public method

Removes the provided connectionInfo from all internal dictionaries. Returns true if connectionInfo exists, otherwise false
public RemovePeerIPEndPoint ( ShortGuid networkIdentifier, IPEndPoint peerIPEndPoint ) : bool
networkIdentifier NetworkCommsDotNet.Tools.ShortGuid The network identifier of the relevant peer
peerIPEndPoint System.Net.IPEndPoint The relevant IPEndPoint
return bool

SetPeerIPEndPointBusyStatus() public method

Update the provided peer IPEndPoint busy status
public SetPeerIPEndPointBusyStatus ( ShortGuid networkIdentifier, IPEndPoint peerIPEndPoint, bool busyStatus ) : void
networkIdentifier NetworkCommsDotNet.Tools.ShortGuid The network identifier of the relevant peer
peerIPEndPoint System.Net.IPEndPoint The relevant IPEndPoint
busyStatus bool The new peer busy status
return void

SetPeerIPEndPointOnlineStatus() public method

Update the provided peer IPEndPoint online status
public SetPeerIPEndPointOnlineStatus ( ShortGuid networkIdentifier, IPEndPoint peerIPEndPoint, bool onlineStatus ) : void
networkIdentifier NetworkCommsDotNet.Tools.ShortGuid The network identifier of the relevant peer
peerIPEndPoint System.Net.IPEndPoint The relevant IPEndPoint
onlineStatus bool The new online status
return void

ToString() public method

Returns a clean descriptor for this PeerInfo
public ToString ( ) : string
return string