unchoker

package
v0.10.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 29, 2019 License: MIT Imports: 2 Imported by: 0

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() uint
	UploadSpeed() uint
}

type Unchoker

type Unchoker struct {
	// contains filtered or unexported fields
}

func New

func New(numUnchoked, numOptimisticUnchoked int) *Unchoker

func (*Unchoker) FastUnchoke

func (u *Unchoker) FastUnchoke(pe Peer)

func (*Unchoker) HandleDisconnect

func (u *Unchoker) HandleDisconnect(pe Peer)

func (*Unchoker) TickUnchoke

func (u *Unchoker) TickUnchoke(allPeers []Peer, torrentCompleted bool)

TickUnchoke must be called at every 10 seconds.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL