C# 클래스 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.
파일 보기 프로젝트 열기: zencoders/sambatyon 1 사용 예제들

공개 메소드들

메소드 설명
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.

비공개 메소드들

메소드 설명
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.

메소드 상세

GetChunk() 공개 메소드

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.
리턴 void

PeerQueueElement() 공개 메소드

Default constructor of the class.
public PeerQueueElement ( ) : System
리턴 System

PeerQueueElement() 공개 메소드

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. ///
리턴 System

Reset() 공개 메소드

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
리턴 void

TimedPeerBlock() 공개 메소드

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.
리턴 void