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

rs_job_iter needs to be called twice with eof=1 #33

Closed
paulharris opened this issue Jun 30, 2015 · 3 comments · Fixed by #122
Closed

rs_job_iter needs to be called twice with eof=1 #33

paulharris opened this issue Jun 30, 2015 · 3 comments · Fixed by #122
Labels

Comments

@paulharris
Copy link

paulharris commented Jun 30, 2015

This smells like a bug,
please see pull request with demonstration and comments.

@sourcefrog
Copy link
Contributor

sourcefrog commented Jul 31, 2016

It does smell suspicious; thanks for the test case.

@dbaarda
Copy link
Member

dbaarda commented Oct 10, 2017

FTR I checked this against master and my recent pull request #119 and it's still there.

Arguably it's not a bug; the documented API says you need to keep calling rs_job_iter() until it returns RS_DONE (or an error). However, it is something that could be done better.

dbaarda added a commit to dbaarda/librsync that referenced this issue Oct 11, 2017
Remove rs_job_s_complete() state function and instead use NULL to
indicate when the job has completed.

Change rs_job_complete() to require the tube is empty when the job is
done and never return RS_BLOCKED. Added asserts to check that this
precondition is met, and that the result is a terminal value.

Added precondition asserts to rs_job_iter() to check its arguments.

Refactored rs_job_work() to be more efficient and continue iterating
after the job is done until the tube is empty before calling
rs_job_complete().
dbaarda added a commit that referenced this issue Oct 11, 2017
Fix #33 rs_job_iter needs calling twice with eof=1.
@sourcefrog
Copy link
Contributor

sourcefrog commented Oct 14, 2017

thanks @dbaarda !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants