Skip to content

Commit

Permalink
修复速度统计BUG
Browse files Browse the repository at this point in the history
  • Loading branch information
nilaoda committed May 30, 2023
1 parent ae4c139 commit 1a5f471
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions BBDown/ProgressBar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,19 @@ public void Report(double value, long bytesCount)
Interlocked.Exchange(ref downloadedBytes, bytesCount);
}

private void SpeedTimerHandler(object? state)
{
lock (speedTimer)
private void SpeedTimerHandler(object? state)
{
lock (speedTimer)
{
if (disposed) return;

if (downloadedBytes > 0)
if (downloadedBytes > 0 && downloadedBytes - lastDownloadedBytes > 0)
{
speedString = " - " + BBDownUtil.FormatFileSize(downloadedBytes - lastDownloadedBytes) + "/s";
lastDownloadedBytes = downloadedBytes;
}
}
}
}

private void TimerHandler(object? state)
{
Expand Down

0 comments on commit 1a5f471

Please sign in to comment.