Documentation ¶
Index ¶
Constants ¶
View Source
const (
// MaxBlockSize allowed in "request" messages.
MaxBlockSize = 16 * 1024
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PeerReader ¶
type PeerReader struct {
// contains filtered or unexported fields
}
PeerReader is used for reading and parsing messages from a net.Conn.
func New ¶
func New(conn net.Conn, l logger.Logger, pieceTimeout time.Duration, b *ratelimit.Bucket) *PeerReader
New returns a new PeerReader by wrapping a net.Conn.
func (*PeerReader) Done ¶
func (p *PeerReader) Done() chan struct{}
Done returns a channel that is closed when the read loop exists.
func (*PeerReader) Messages ¶
func (p *PeerReader) Messages() <-chan interface{}
Messages returns a channel. All messages read by this PeerReader is sent to this channel.
type Piece ¶
type Piece struct { peerprotocol.PieceMessage Buffer bufferpool.Buffer }
Piece message that is read from peers. Data of the piece is wrapped with a bufferpool.Buffer object.
Click to show internal directories.
Click to hide internal directories.