Merge branch 'master' of github.com:anacrolix/torrent
This commit is contained in:
commit
de69976bbf
|
@ -109,18 +109,25 @@ func (me data) WriteSectionTo(w io.Writer, off, n int64) (written int64, err err
|
|||
if err != nil {
|
||||
return
|
||||
}
|
||||
n1, err = io.Copy(w, io.NewSectionReader(f, off, n1))
|
||||
var w1 int64
|
||||
w1, err = io.Copy(w, io.NewSectionReader(f, off, n1))
|
||||
f.Close()
|
||||
if err != nil {
|
||||
written += w1
|
||||
if w1 != n1 {
|
||||
if err == nil || err == io.EOF {
|
||||
err = io.ErrUnexpectedEOF
|
||||
}
|
||||
return
|
||||
} else {
|
||||
err = nil
|
||||
}
|
||||
written += n1
|
||||
off = 0
|
||||
n -= n1
|
||||
if n == 0 {
|
||||
break
|
||||
return
|
||||
}
|
||||
}
|
||||
err = io.EOF
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -673,7 +673,7 @@ func (t *torrent) hashPiece(piece pp.Integer) (ps pieceSum) {
|
|||
return
|
||||
}
|
||||
if n != pl {
|
||||
panic("lame")
|
||||
panic(fmt.Sprintf("%T: %d != %d", t.data, n, pl))
|
||||
}
|
||||
missinggo.CopyExact(ps[:], hash.Sum(nil))
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue