Skip to content
This repository has been archived by the owner on Nov 2, 2018. It is now read-only.

Report download progress per piece instead of per chunk #3165

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions modules/renter/downloadchunk.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"bytes"
"fmt"
"sync"
"sync/atomic"
"time"

"github.com/NebulousLabs/Sia/crypto"
Expand Down Expand Up @@ -229,7 +228,6 @@ func (udc *unfinishedDownloadChunk) threadedRecoverLogicalData() error {
udc.download.mu.Lock()
defer udc.download.mu.Unlock()
udc.download.chunksRemaining--
atomic.AddUint64(&udc.download.atomicDataReceived, udc.staticFetchLength)
if udc.download.chunksRemaining == 0 {
// Download is complete, send out a notification and close the
// destination writer.
Expand Down
1 change: 1 addition & 0 deletions modules/renter/workerdownload.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ func (w *worker) managedDownload(udc *unfinishedDownloadChunk) {
udc.piecesCompleted++
udc.piecesRegistered--
if udc.piecesCompleted <= udc.erasureCode.MinPieces() {
atomic.AddUint64(&udc.download.atomicDataReceived, udc.staticFetchLength/uint64(udc.erasureCode.MinPieces()))
udc.physicalChunkData[pieceIndex] = decryptedPiece
}
if udc.piecesCompleted == udc.erasureCode.MinPieces() {
Expand Down