Skip to content

Conversation

@dbaarda
Copy link
Member

@dbaarda dbaarda commented Oct 11, 2017

This fixes #33 and tidies up and optimizes the rs_job_iter() code. It removes code checking for programming errors and replaces them with more extensive precondition asserts.

I also slightly cleaned and optimized rs_tube_catchup() when there is nothing to catchup.

It also includes changing rs_job_check() from a function to a #define so it gets completely optimized away when debugging is turned off and more clearly indicates where the job was bad when asserts fail.

When the tube is already "caught up" this will short-circuit it's
evaluation better.
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().
This ensures that it is completely optimized away when debugging is
turned off, and more clearly indicates where in the code the job was
invalid when the asserts fail.

This also required changing rs_job_tag to a #define RS_JOB_TAG.
@dbaarda
Copy link
Member Author

dbaarda commented Oct 11, 2017

This is another small bug fix. Not much point in waiting for it, I'm going to merge it now.

@dbaarda dbaarda merged commit a13dbb9 into librsync:master Oct 11, 2017
@dbaarda dbaarda deleted the fix/job_iter1 branch October 11, 2017 06:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rs_job_iter needs to be called twice with eof=1

1 participant