Class RubyTorrent::PeerConnection
In: lib/rubytorrent/peer.rb
Parent: Object

The PeerConnection object deals with all the protocol issues. It keeps state information as to the connection and the peer. It is tightly integrated with the Controller object.

Remember to be "strict in what you send, lenient in what you accept".

Methods

Included Modules

EventSource

Constants

BUFSIZE = 8192
MAX_PEER_REQUESTS = 5
MAX_REQUESTS = 5
MIN_REQUESTS = 1
REQUEST_TIMEOUT = 60

Attributes

name  [R] 
peer_pieces  [R] 

Public Class methods

decide it‘s been forgotten

Public Instance methods

called by Controller in the event that a request needs to be rescinded.

the Controller calls this from heartbeat thread to tell us whether to choke or not.

Controller calls this to tell us that a complete piece has been received.

this is called both by input_thread_step and by the controller‘s heartbeat thread. it sends as many pending blocks as it can while keeping the amount below ‘ullim’, and sends as many requests as it can while keeping the amount below ‘dllim’.

returns the number of bytes requested and sent

Controller calls this to tell us to send a keepalive

the Controller calls this from heartbeat thread to tell us whether to snub or not.

[Validate]