From 7f2838925ad0ce6d7620f40103201edea5c01991 Mon Sep 17 00:00:00 2001 From: Jim Ma Date: Wed, 1 Dec 2021 19:28:50 +0800 Subject: [PATCH] fix: file peer task back source digest not match (#849) Signed-off-by: Jim Ma --- client/daemon/peer/piece_manager.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/client/daemon/peer/piece_manager.go b/client/daemon/peer/piece_manager.go index d09deacaf40..ef35bf1f5da 100644 --- a/client/daemon/peer/piece_manager.go +++ b/client/daemon/peer/piece_manager.go @@ -397,10 +397,6 @@ func (pm *pieceManager) DownloadSource(ctx context.Context, pt Task, request *sc return storage.ErrShortRead } } - pt.SetTotalPieces(maxPieceNum) - if err := pt.SetContentLength(contentLength); err != nil { - log.Errorf("set content length failed %s", err) - } if err := pm.storageManager.UpdateTask(ctx, &storage.UpdateTaskRequest{ @@ -414,6 +410,10 @@ func (pm *pieceManager) DownloadSource(ctx context.Context, pt Task, request *sc }); err != nil { log.Errorf("update task failed %s", err) } + if err := pt.SetContentLength(contentLength); err != nil { + log.Errorf("set content length failed %s", err) + } + log.Infof("download from source ok") return nil }