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

Refactor: return the amount of bytes if possible #8

Merged
merged 1 commit into from
Jan 20, 2017
Merged

Refactor: return the amount of bytes if possible #8

merged 1 commit into from
Jan 20, 2017

Conversation

steffengy
Copy link
Contributor

@steffengy steffengy commented Jan 20, 2017

THIS IS A BREAKING CHANGE! (Bump -> 0.2)

This unifies the API surface we expose here to always return an Option
where it makes sense.

the winsock functions return the amount of affected (written or read)
bytes directly. This result is only valid if the function returns
success
and invalid (if an error or WSA_IO_PENDING is returned) otherwise.
we map the success case to Some(bytes) and the case of IO_PENDING to None.

We also use this opportunity, to add a possibility to pass a buffer into
connect_ex which is written after the connection is established,
so we can include connect_ex in the refactoring.

related to: tokio-rs/mio#520

the winsock functions return the amount of affected (written or read)
bytes directly. This result is only valid if the function returns
success and invalid (error or WSA_IO_PENDING) otherwise.
we map the success case to Some(bytes) and the case of IO_PENDING to None.
@alexcrichton
Copy link
Collaborator

Thanks!

@alexcrichton alexcrichton merged commit 787e6a0 into yoshuawuyts:master Jan 20, 2017
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