Update _socket to use the socket2 crate; similar to the C sockets api - #1572
Merged
Conversation
coolreader18
force-pushed
the
coolreader18/socket-socket2
branch
6 times, most recently
from
October 27, 2019 03:02
3e5b4c4 to
116aa9c
Compare
Contributor
|
@coolreader18 can you split this PR into smaller ones? It will be easier to review that way |
coolreader18
force-pushed
the
coolreader18/socket-socket2
branch
2 times, most recently
from
October 28, 2019 04:01
dc3a132 to
dac1df1
Compare
Member
Author
coolreader18
force-pushed
the
coolreader18/socket-socket2
branch
3 times, most recently
from
October 28, 2019 17:55
a2954e6 to
ec93629
Compare
It closely mirrors the unix C api for sockets, which is good because Python does as well.
coolreader18
force-pushed
the
coolreader18/socket-socket2
branch
from
October 29, 2019 03:29
ec93629 to
460e149
Compare
palaviv
approved these changes
Nov 1, 2019
palaviv
left a comment
Contributor
There was a problem hiding this comment.
Looks good. Just a few comments added. I hoped we would be able to use the std::net connection but this is way simpler.
| } | ||
| fn flush(&mut self) -> io::Result<()> { | ||
| Ok(()) | ||
| Ok(vm.ctx.new_tuple(vec![fd, addr_tuple])) |
Contributor
There was a problem hiding this comment.
You can return here (fd, addr_tuple)
| let mut buffer = vec![0u8; bufsize]; | ||
| let addr = match self.sock().recv_from(&mut buffer) { | ||
| Ok((_, addr)) => addr, | ||
| Err(ref e) if e.kind() == io::ErrorKind::TimedOut => { |
Contributor
There was a problem hiding this comment.
I would suggest adding a function name convert_socket_error that will check if this is a timeout and then call convert_io_error. That will remove a lot of duplication.
coolreader18
force-pushed
the
coolreader18/socket-socket2
branch
from
November 1, 2019 22:42
8b6fabd to
e563945
Compare
Contributor
|
@coolreader18 can you look at #1580? The windows test of select failed there. |
Member
Author
|
I'm not sure, that's a really weird failure. I tried rerunning it but the checkout failed because the branch is deleted. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Also adds
socket.pyfrom CPython 3.6.0