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

Cancel and return failure when user aborted connection #13

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Ruakij
Copy link

@Ruakij Ruakij commented Jul 22, 2023

When the user has aborted the connection, we should detect it and stop reading & packing the current file we are working on.

I wasnt sure what the best way is to bubble the failure to addFileFromStream, so i just set everything to 0 and checked that.
Feel free to change that.

Because we have already written some data to the outputStream, i consider it dirty. Maybe we should add that to the function documentation?

// Before potentially reading the next chunk, check if user aborted the connection.
// Ignored (not aborted), when ignore_user_abort is set.
if (connection_aborted() === 1 && ignore_user_abort() === 0) {
return array(0, 0, 0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about throwing an exception here? The first element is expected to be an Count64 instance.

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.

None yet

3 participants