Skip to content

Commit

Permalink
fix: client break error (dragonflyoss#1190)
Browse files Browse the repository at this point in the history
Signed-off-by: Jim Ma <[email protected]>
  • Loading branch information
jim3ma authored Mar 25, 2022
1 parent 66194b0 commit 730681c
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions client/daemon/peer/peertask_stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,20 +182,20 @@ func (s *streamTask) writeToPipe(firstPiece *PieceInfo, pw *io.PipeWriter) {
}

select {
case piece = <-s.pieceCh:
continue
case <-s.peerTaskConductor.successCh:
s.writeRemainingPieces(desired, pw)
return
case <-s.ctx.Done():
err = fmt.Errorf("context done due to: %s", s.ctx.Err())
s.closeWithError(pw, err)
break
case piece = <-s.pieceCh:
continue
return
case <-s.peerTaskConductor.failCh:
err = fmt.Errorf("context done due to peer task fail: %d/%s",
s.peerTaskConductor.failedCode, s.peerTaskConductor.failedReason)
s.closeWithError(pw, err)
break
case <-s.peerTaskConductor.successCh:
s.writeRemainingPieces(desired, pw)
break
return
}
}
}
Expand Down

0 comments on commit 730681c

Please sign in to comment.