changes as per review

This commit is contained in:
Aarsh Shah 2022-02-21 18:27:51 +04:00
parent c2522e8ca9
commit 56926b349a
2 changed files with 4 additions and 5 deletions

View File

@ -315,7 +315,7 @@ func (m *Sealing) SectorAddPieceToAny(ctx context.Context, size abi.UnpaddedPiec
m.inputLk.Unlock()
select {
case <-pp.doneCh:
res := pp.resp.Load().(*pieceAcceptResp)
res := pp.resp
return api.SectorOffset{Sector: res.sn, Offset: res.offset.Padded()}, res.err
case <-ctx.Done():
return api.SectorOffset{}, ctx.Err()
@ -331,7 +331,7 @@ func (m *Sealing) SectorAddPieceToAny(ctx context.Context, size abi.UnpaddedPiec
assigned: false,
}
pp.accepted = func(sn abi.SectorNumber, offset abi.UnpaddedPieceSize, err error) {
pp.resp.Store(&pieceAcceptResp{sn, offset, err})
pp.resp = &pieceAcceptResp{sn, offset, err}
close(pp.doneCh)
}
@ -345,7 +345,7 @@ func (m *Sealing) SectorAddPieceToAny(ctx context.Context, size abi.UnpaddedPiec
select {
case <-doneCh:
res := pp.resp.Load().(*pieceAcceptResp)
res := pp.resp
return api.SectorOffset{Sector: res.sn, Offset: res.offset.Padded()}, res.err
case <-ctx.Done():
return api.SectorOffset{}, ctx.Err()

View File

@ -4,7 +4,6 @@ import (
"context"
"errors"
"sync"
"sync/atomic"
"time"
"github.com/ipfs/go-cid"
@ -149,7 +148,7 @@ type pieceAcceptResp struct {
type pendingPiece struct {
doneCh chan struct{}
resp atomic.Value
resp *pieceAcceptResp
size abi.UnpaddedPieceSize
deal api.PieceDealInfo