-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add naettGetTotalBytesRead #18
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. The only issue with this is that it extends the non-thread-safe handling of the completed
field with the progress field. I'll add an issue about that.
Of course some conflicts. If you rebase on main, I'll merge! |
will do! also, accesses to 32-bit fields are effectively atomic - although unlike actual atomics not with respect to surrounding operations since the compiler can move stuff around, but progress only needs to be approximate anyway, so... |
f68917d
to
bcf4ee1
Compare
Rebased on main. |
Hm, looks like a linking error with the "min" function. I don't get that error myself, but I'll try to do something. |
Yep, it's just the reordering that can be an issue. Yes, the definition of |
BTW, I've fixed the warnings in the test rig locally. |
Took the easy way out. By the way, thanks for this convenient little library. Exactly what I needed, and I'll probably end up using it in more projects in the future. |
Still fails on the old uses of You're welcome. This little library was just what I needed as well :) |
Alright, I'll move back to that. Although, I don't see where those old uses are - I don't see any in the code. |
OK the windows test runner is clearly not even using my latest changes, it seems to be running an older build. Not sure what's going on. |
Weird. I'll fix! |
Moved this to a new PR #23 For branching / workflow reasons. |
This lets you implement a progress bar for downloads safely and efficiently by calling
naettGetTotalBytesRead()
after checkingnaettComplete()
and finding out it's not done yet.The first commit makes sure that res->headers only gets written to once by the various backends. This is not actually needed for the two later commits, and still doesn't technically make it safe to read headers before the full request is complete (although in practice it'll be), but it's still good practice and probably a slight performance improvement. Not implemented in linux.c though because it's less convenient to do there.
Fixes #16