From 332c9763ca75bc60926fdda3c3b246ac85f9d863 Mon Sep 17 00:00:00 2001 From: Gaius Date: Wed, 8 Dec 2021 16:17:31 +0800 Subject: [PATCH] feat: dfdaemon update content length (#895) * feat: dfdaemon update content length Signed-off-by: Gaius * feat: error check Signed-off-by: Gaius --- client/daemon/peer/peertask_base.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/client/daemon/peer/peertask_base.go b/client/daemon/peer/peertask_base.go index b2770165cde..5b570259994 100644 --- a/client/daemon/peer/peertask_base.go +++ b/client/daemon/peer/peertask_base.go @@ -472,6 +472,13 @@ loop: pt.Debugf("update digest: %s", pt.md5) } + // update content length + if piecePacket.ContentLength > 0 { + _ = pt.SetContentLength(piecePacket.ContentLength) + _ = pt.callback.Update(pt) + pt.Debugf("update content length: %d", pt.GetContentLength()) + } + // 3. dispatch piece request to all workers pt.dispatchPieceRequest(pieceRequestCh, piecePacket)