Skip to content

Commit 40debc2

Browse files
author
Jeff Becker
committed
go fmt
1 parent 68cb63b commit 40debc2

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lib/bittorrent/swarm/piece.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,16 @@ type cachedPiece struct {
2424

2525
// should we accept a piece data with offset and length ?
2626
func (p *cachedPiece) accept(offset, length uint32) bool {
27-
if offset % BlockSize != 0 {
27+
if offset%BlockSize != 0 {
2828
log.Errorf("Rejecting chunk where piece offset=%d % BlockSize=%d != 0", offset, BlockSize)
2929
return false
3030
}
3131

32-
if offset + length > p.length {
33-
log.Errorf("Rejecting chunk where piece ending offset=%d > piece length=%d", offset + length, p.length)
32+
if offset+length > p.length {
33+
log.Errorf("Rejecting chunk where piece ending offset=%d > piece length=%d", offset+length, p.length)
3434
return false
35-
}
36-
35+
}
36+
3737
if p.bitfieldIndex(offset) == p.finalChunkBitfieldIndex() {
3838
// last piece
3939
if length != p.finalChunkLen() {
@@ -158,7 +158,7 @@ func (pt *pieceTracker) newPiece(piece uint32) bool {
158158

159159
sz := info.LengthOfPiece(piece)
160160
bits := sz / BlockSize
161-
if sz % BlockSize != 0 {
161+
if sz%BlockSize != 0 {
162162
bits++
163163
}
164164
log.Debugf("new piece idx=%d len=%d bits=%d", piece, sz, bits)

0 commit comments

Comments
 (0)