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

Make nestegg_read_packet resumable #37

Merged
merged 3 commits into from
May 19, 2016
Merged

Make nestegg_read_packet resumable #37

merged 3 commits into from
May 19, 2016

Conversation

kinetiknz
Copy link
Collaborator

This work is part of BMO #1261900.

Gecko's MSE implementation needs to be able to run nestegg_read_packet
until it hits EOS, producing every packet it can parse, and then restore
the parser state when new data is appended to the stream and resume
parsing from the last valid block.

nestegg_read_reset introduces a way to reset the parser context to the
beginning of the last point before a nestegg_read_packet call returned
EOS. If the stream then has sufficient data appended to it, a
subsequent call to nestegg_read_packet is then expected to produce the
next packet(s) without producing any previously parsed packets.

Note that this mode requires the caller to carefully manage the EOS
state so that it can distinguish between "fake" EOS and "real" EOS.

Removing the general ne_parse machinery from nestegg_read_packet
significantly reduces the potential state changes to rollback on reset.
The small amount of remaining state is saved with ne_ctx_save and
restored via ne_ctx_restore.

Gecko's MSE implementation needs to be able to run nestegg_read_packet
until it hits EOS, producing every packet it can parse, and then restore
the parser state when new data is appended to the stream and resume
parsing from the last valid block.

nestegg_read_reset introduces a way to reset the parser context to the
beginning of the last point before a nestegg_read_packet call returned
EOS.  If the stream then has sufficient data appended to it, a
subsequent call to nestegg_read_packet is then expected to produce the
next packet(s) without producing any previously parsed packets.

Note that this mode requires the caller to carefully manage the EOS
state so that it can distinguish between "fake" EOS and "real" EOS.

Removing the general ne_parse machinery from nestegg_read_packet
significantly reduces the potential state changes to rollback on reset.
The small amount of remaining state is saved with ne_ctx_save and
restored via ne_ctx_restore.
@rillian
Copy link
Contributor

rillian commented May 18, 2016

lgtm

@kinetiknz kinetiknz merged commit 39f7bf7 into master May 19, 2016
@kinetiknz kinetiknz deleted the bug1261900 branch May 19, 2016 02:53
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.

2 participants