Skip to content
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

Preparation for http multi #219

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
casync-http: Fix handling of ca_remote_has_unwritten() return value
It seems to me that the condition PROCESS_UNTIL_WRITTEN is reached when
there's no more data to write, hence ca_remote_has_unwritten() returns
0.

And it also seems that this is could be copy/paste mistake, as all the
code above is similar, but the condition matches the function we call,
ie:
- PROCESS_UNTIL_CAN_PUT_CHUNK > ca_remote_can_put_chunk
- PROCESS_UNTIL_CAN_PUT_INDEX > ca_remote_can_put_index
- PROCESS_UNTIL_CAN_PUT_ARCHIVE > ca_remote_can_put_archive
- PROCESS_UNTIL_HAVE_REQUEST > ca_remote_has_pending_requests

But here, the function returns the opposite of what we want:
- PROCESS_UNTIL_WRITTEN > ca_remote_has_unwritten

Note that I didn't observe any bug due to that, and the test suite
succeeds before and after this patch.

Signed-off-by: Arnaud Rebillout <[email protected]>
  • Loading branch information
elboulangero committed Jun 25, 2019
commit ed01920db5f7fd6d6f85bf30c62eb0bcccaf24b7
2 changes: 1 addition & 1 deletion src/casync-http.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ static int process_remote(CaRemote *rr, ProcessUntil until) {
return r;
if (r < 0)
return log_error_errno(r, "Failed to determine whether there's more data to write.");
if (r > 0)
if (r == 0)
return 0;

break;
Expand Down