diff options
| author | Dustin Mierau <dustin@mierau.me> | 2025-11-11 15:39:02 -0800 |
|---|---|---|
| committer | Dustin Mierau <dustin@mierau.me> | 2025-11-11 15:39:02 -0800 |
| commit | f87ff05d17cedf21845abbb8d750759ba725a263 (patch) | |
| tree | 154feff5eed1b3f7787eeb2f743ffe6602b6cd31 /Hotline/Library/NetSocket/TransferRateEstimator.swift | |
| parent | cdaff85ac22f45e39ab1f02474beaa7aada9ad9b (diff) | |
Folder download logic cleanup. Display folder icon on folder download transfers with small icon for the current file. Fix progress for folder downloads.
Diffstat (limited to 'Hotline/Library/NetSocket/TransferRateEstimator.swift')
| -rw-r--r-- | Hotline/Library/NetSocket/TransferRateEstimator.swift | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Hotline/Library/NetSocket/TransferRateEstimator.swift b/Hotline/Library/NetSocket/TransferRateEstimator.swift index badf87a..61383ff 100644 --- a/Hotline/Library/NetSocket/TransferRateEstimator.swift +++ b/Hotline/Library/NetSocket/TransferRateEstimator.swift @@ -70,6 +70,7 @@ public struct TransferRateEstimator { self.minSamples = minSamples } + @discardableResult public mutating func update(total: Int) -> NetSocket.FileProgress { return self.update(bytes: max(0, total - self.transferred)) } @@ -80,6 +81,7 @@ public struct TransferRateEstimator { /// /// - Parameter bytes: Number of bytes transferred in this sample /// - Returns: Current progress with speed and ETA estimates + @discardableResult public mutating func update(bytes: Int) -> NetSocket.FileProgress { let clock = ContinuousClock() let now = clock.now @@ -127,6 +129,7 @@ public struct TransferRateEstimator { return NetSocket.FileProgress( sent: self.transferred, total: self.total, + now: bytes, bytesPerSecond: haveEstimate ? self.emaBytesPerSecond : nil, estimatedTimeRemaining: eta ) |