dagstore pieceReader: Fix wrong ErrUnexpectedEOF return in ReadAt
This commit is contained in:
parent
cde687bbe1
commit
ea9130256c
@ -30,7 +30,6 @@ func TestLotusMount(t *testing.T) {
|
|||||||
mockLotusMountAPI := mock_dagstore.NewMockMinerAPI(mockCtrl)
|
mockLotusMountAPI := mock_dagstore.NewMockMinerAPI(mockCtrl)
|
||||||
|
|
||||||
mockLotusMountAPI.EXPECT().IsUnsealed(gomock.Any(), cid).Return(true, nil).Times(1)
|
mockLotusMountAPI.EXPECT().IsUnsealed(gomock.Any(), cid).Return(true, nil).Times(1)
|
||||||
|
|
||||||
mockLotusMountAPI.EXPECT().FetchUnsealedPiece(gomock.Any(), cid, uint64(0)).Return(ioutil.NopCloser(strings.NewReader("testing")), abi.UnpaddedPieceSize(7), nil).Times(1)
|
mockLotusMountAPI.EXPECT().FetchUnsealedPiece(gomock.Any(), cid, uint64(0)).Return(ioutil.NopCloser(strings.NewReader("testing")), abi.UnpaddedPieceSize(7), nil).Times(1)
|
||||||
mockLotusMountAPI.EXPECT().FetchUnsealedPiece(gomock.Any(), cid, uint64(0)).Return(ioutil.NopCloser(strings.NewReader("testing")), abi.UnpaddedPieceSize(7), nil).Times(1)
|
mockLotusMountAPI.EXPECT().FetchUnsealedPiece(gomock.Any(), cid, uint64(0)).Return(ioutil.NopCloser(strings.NewReader("testing")), abi.UnpaddedPieceSize(7), nil).Times(1)
|
||||||
mockLotusMountAPI.EXPECT().GetUnpaddedCARSize(ctx, cid).Return(uint64(100), nil).Times(1)
|
mockLotusMountAPI.EXPECT().GetUnpaddedCARSize(ctx, cid).Return(uint64(100), nil).Times(1)
|
||||||
|
@ -155,6 +155,9 @@ func (p *pieceReader) ReadAt(b []byte, off int64) (n int, err error) {
|
|||||||
if n < len(b) {
|
if n < len(b) {
|
||||||
log.Debugw("pieceReader short read", "piece", p.pieceCid, "at", p.rAt, "toEnd", int64(p.len)-p.rAt, "n", len(b), "read", n, "err", err)
|
log.Debugw("pieceReader short read", "piece", p.pieceCid, "at", p.rAt, "toEnd", int64(p.len)-p.rAt, "n", len(b), "read", n, "err", err)
|
||||||
}
|
}
|
||||||
|
if err == io.ErrUnexpectedEOF {
|
||||||
|
err = io.EOF
|
||||||
|
}
|
||||||
|
|
||||||
p.rAt += int64(n)
|
p.rAt += int64(n)
|
||||||
return n, err
|
return n, err
|
||||||
|
Loading…
Reference in New Issue
Block a user