Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Peer ¶
type Peer interface { // Sends messages and set choking status of local peeer Choke() Unchoke() // Choking returns choke status of local peer Choking() bool // Interested returns interest status of remote peer Interested() bool // SetOptimistic sets the uptimistic unchoke status of peer SetOptimistic(value bool) // OptimisticUnchoked returns the value previously set by SetOptimistic Optimistic() bool DownloadSpeed() int UploadSpeed() int }
Peer of a torrent.
type Unchoker ¶
type Unchoker struct {
// contains filtered or unexported fields
}
Unchoker implements an algorithm to select peers to unchoke based on their download speed.
func (*Unchoker) FastUnchoke ¶
FastUnchoke must be called when remote peer is interested. Remote peer is unchoked immediately if there are not enough unchoked peers. Without this function, remote peer would have to wait for next unchoke period.
func (*Unchoker) HandleDisconnect ¶
HandleDisconnect must be called to remove the peer from internal indexes.
func (*Unchoker) TickUnchoke ¶
TickUnchoke must be called at every 10 seconds.
Click to show internal directories.
Click to hide internal directories.