Preserve statistics on reset failures and reject invalid accounting data
This commit is contained in:
1 parent
a4ac70a276
commit
a749ef5c15
2 files changed
+77
-31
No files matched your search
@@ -135,8 +135,8 @@ class UploadManager extends EventEmitter {
|
||||
}
|
||||
|
||||
_recordTransferred(entry, bytes, total) {
|
||||
if (!Number.isFinite(bytes) || bytes < 0) return;
|
||||
const next = Math.min(bytes, total);
|
||||
if (!Number.isFinite(bytes) || bytes < 0 || !Number.isFinite(total) || total < 0) return;
|
||||
const next = Math.max(entry.bytesUploaded || 0, Math.min(bytes, total));
|
||||
const delta = Math.max(0, next - entry.bytesUploaded);
|
||||
this.transferredBytes += delta;
|
||||
if (delta > 0) this.emit('statistics-transfer', { hoster: entry.hoster, bytes: delta });
|
||||
|
||||
Reference in new issue
Block a user