go fmt ./...

This commit is contained in:
Matt Joiner 2021-10-05 17:48:52 +11:00
parent da1221dd50
commit fd8995dcfd
3 changed files with 7 additions and 8 deletions

View File

@ -10,10 +10,10 @@ import (
const (
pieceHash = crypto.SHA1
defaultChunkSize = 0x4000 // 16KiB
// Arbitrary maximum of "metadata_size" (see https://www.bittorrent.org/beps/bep_0009.html)
// This value is 2x what libtorrent-rasterbar uses, which should be plenty
maxMetadataSize uint32 = 8*1024*1024
maxMetadataSize uint32 = 8 * 1024 * 1024
)
// These are our extended message IDs. Peers will use these values to

View File

@ -30,15 +30,15 @@ type pieceRange struct {
}
type reader struct {
t *Torrent
t *Torrent
// Adjust the read/seek window to handle Readers locked to File extents and the like.
offset, length int64
// Function to dynamically calculate readahead. If nil, readahead is static.
readaheadFunc func() int64
// Required when modifying pos and readahead.
mu sync.Locker
mu sync.Locker
readahead, pos int64
// Position that reads have continued contiguously from.
@ -52,7 +52,6 @@ type reader struct {
// after a seek or with a new reader at the starting position.
reading bool
responsive bool
}
var _ io.ReadSeekCloser = (*reader)(nil)

2
t.go
View File

@ -78,7 +78,7 @@ func (t *Torrent) PieceState(piece pieceIndex) (ps PieceState) {
t.cl.rLock()
ps = t.pieceState(piece)
t.cl.rUnlock()
return
return
}
// The number of pieces in the torrent. This requires that the info has been