minor refactoring

This commit is contained in:
rootdarkarchon
2024-03-17 14:43:34 +01:00
parent 142c65cc9d
commit 7baca3565a
34 changed files with 554 additions and 627 deletions

View File

@@ -152,10 +152,10 @@
/// <inheritdoc />
public override string ToString()
{
return _baseStream.ToString();
return _baseStream?.ToString() ?? string.Empty;
}
private class Bandwidth
private sealed class Bandwidth
{
private long _count;
private int _lastSecondCheckpoint;
@@ -175,7 +175,7 @@
{
int elapsedTime = Environment.TickCount - _lastSecondCheckpoint + 1;
receivedBytesCount = Interlocked.Add(ref _lastTransferredBytesCount, receivedBytesCount);
double momentSpeed = receivedBytesCount * 1000 / elapsedTime; // B/s
double momentSpeed = receivedBytesCount * 1000 / (double)elapsedTime; // B/s
if (1000 < elapsedTime)
{