File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -24,16 +24,16 @@ type cachedPiece struct {
24
24
25
25
// should we accept a piece data with offset and length ?
26
26
func (p * cachedPiece ) accept (offset , length uint32 ) bool {
27
- if offset % BlockSize != 0 {
27
+ if offset % BlockSize != 0 {
28
28
log .Errorf ("Rejecting chunk where piece offset=%d % BlockSize=%d != 0" , offset , BlockSize )
29
29
return false
30
30
}
31
31
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 )
34
34
return false
35
- }
36
-
35
+ }
36
+
37
37
if p .bitfieldIndex (offset ) == p .finalChunkBitfieldIndex () {
38
38
// last piece
39
39
if length != p .finalChunkLen () {
@@ -158,7 +158,7 @@ func (pt *pieceTracker) newPiece(piece uint32) bool {
158
158
159
159
sz := info .LengthOfPiece (piece )
160
160
bits := sz / BlockSize
161
- if sz % BlockSize != 0 {
161
+ if sz % BlockSize != 0 {
162
162
bits ++
163
163
}
164
164
log .Debugf ("new piece idx=%d len=%d bits=%d" , piece , sz , bits )
You can’t perform that action at this time.
0 commit comments