Skip to content

Commit

Permalink
chore: add content length for fast stream peer task (dragonflyoss#1061)
Browse files Browse the repository at this point in the history
Signed-off-by: Jim Ma <[email protected]>
  • Loading branch information
jim3ma authored Feb 11, 2022
1 parent fed4f56 commit 3403d3b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions client/daemon/peer/peertask_stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,11 @@ func (s *streamTask) Start(ctx context.Context) (io.ReadCloser, map[string]strin
return nil, attr, fmt.Errorf("peer task failed: %d/%s",
s.peerTaskConductor.failedCode, s.peerTaskConductor.failedReason)
case <-s.peerTaskConductor.successCh:
if s.peerTaskConductor.GetContentLength() != -1 {
attr[headers.ContentLength] = fmt.Sprintf("%d", s.peerTaskConductor.GetContentLength())
} else {
attr[headers.TransferEncoding] = "chunked"
}
rc, err := s.peerTaskConductor.peerTaskManager.storageManager.ReadAllPieces(
ctx,
&storage.ReadAllPiecesRequest{
Expand Down

0 comments on commit 3403d3b

Please sign in to comment.