piecedownloader

package
v0.17.3 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBlockDuplicate    = errors.New("received duplicate block")
	ErrBlockNotRequested = errors.New("received not requested block")
)

Functions

This section is empty.

Types

type Peer added in v0.5.0

type Peer interface {
	RequestPiece(index, begin, length uint32)
	CancelPiece(index, begin, length uint32)
	EnabledFast() bool
}

type PieceDownloader

type PieceDownloader struct {
	Piece       *piece.Piece
	Peer        Peer
	AllowedFast bool
	Buffer      bufferpool.Buffer
	// contains filtered or unexported fields
}

PieceDownloader downloads all blocks of a piece from a peer.

func New

func New(pi *piece.Piece, pe Peer, allowedFast bool, buf bufferpool.Buffer) *PieceDownloader

func (*PieceDownloader) CancelPending

func (d *PieceDownloader) CancelPending()

func (*PieceDownloader) Choked

func (d *PieceDownloader) Choked()

func (*PieceDownloader) Done

func (d *PieceDownloader) Done() bool

func (*PieceDownloader) GotBlock

func (d *PieceDownloader) GotBlock(block piece.Block, data []byte) error

func (*PieceDownloader) Rejected

func (d *PieceDownloader) Rejected(block piece.Block)

func (*PieceDownloader) RequestBlocks

func (d *PieceDownloader) RequestBlocks(queueLength int)

Jump to

Keyboard shortcuts

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