C# Class TransportService.PeerQueueElement

This class represent an abstraction of the peer from the point of view of a requestor. It is used inside a PeerQueue. The class internally stores a channel used to communicate with other peer. It is useful to avoid opening and closing the channel. This class is strictly coupled with PeerQueue.
Afficher le fichier Open project: zencoders/sambatyon Class Usage Examples

Méthodes publiques

Méthode Description
GetChunk ( ChunkRequest chkrq ) : void

Method used to require a chunk to the peer represented by the inner channel.

PeerQueueElement ( ) : System

Default constructor of the class.

PeerQueueElement ( string peerAddress, float peerScore, AutoResetEvent &peerQueueNotEmpty ) : System

Constructor of the class that effectively valorize its attributes.

Reset ( ) : void

Method actively used to reset a peer putting it in free state. If the peer have a timer active the timer is disabled.

TimedPeerBlock ( int millis ) : void

Method used to block the peer (avoid to request again) for a certain number of milliseconds as passed by argument. For the time indicated the peer is put in the BUSY state; after that time the peer is resettled in FREE state.

Private Methods

Méthode Description
timerHandler ( object source, EventArgs e ) : void

Method called by the timer to automatically call the Reset method. Each time this method is called the peer score is augmented by one.

Method Details

GetChunk() public méthode

Method used to require a chunk to the peer represented by the inner channel.
public GetChunk ( ChunkRequest chkrq ) : void
chkrq TransportService.Messages.ChunkRequest ChunkRequest object containing informations about the resource.
Résultat void

PeerQueueElement() public méthode

Default constructor of the class.
public PeerQueueElement ( ) : System
Résultat System

PeerQueueElement() public méthode

Constructor of the class that effectively valorize its attributes.
public PeerQueueElement ( string peerAddress, float peerScore, AutoResetEvent &peerQueueNotEmpty ) : System
peerAddress string URI address of the peer
peerScore float Score of the peer (the less it is the better is the peer
peerQueueNotEmpty System.Threading.AutoResetEvent /// AutoResetEvent used to communicate to the Peer Queue that the queue is not empty. ///
Résultat System

Reset() public méthode

Method actively used to reset a peer putting it in free state. If the peer have a timer active the timer is disabled.
public Reset ( ) : void
Résultat void

TimedPeerBlock() public méthode

Method used to block the peer (avoid to request again) for a certain number of milliseconds as passed by argument. For the time indicated the peer is put in the BUSY state; after that time the peer is resettled in FREE state.
public TimedPeerBlock ( int millis ) : void
millis int time used to block the peer.
Résultat void