Use the patched naett functions to implement progress updates

This commit is contained in:
Henrik Rydgård committed 2023-07-21 18:23:33 +02:00
1 parent c17a559188
commit 9535b16740
8 files changed
+52 -39

No files matched your search

+12
View File
@@ -22,6 +22,18 @@
namespace net {
void RequestProgress::Update(int64_t downloaded, int64_t totalBytes, bool done) {
if (totalBytes) {
progress = (double)downloaded / (double)totalBytes;
} else {
progress = 0.01f;
}
if (callback) {
callback(downloaded, totalBytes, done);
}
}
bool Buffer::FlushSocket(uintptr_t sock, double timeout, bool *cancelled) {
static constexpr float CANCEL_INTERVAL = 0.25f;
for (size_t pos = 0, end = data_.size(); pos < end; ) {