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
Remove net2 dependency #1029
Remove net2 dependency #1029
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine to me. One thought re copyright.
Note to self: check for the same problem as in #1031 in the changes I'm going to make. |
We should be fine to move forward w/ this if you want to. |
@carllerche I was thinking about waiting until the Windows rewrite as I imagine there will a number of merge conflicts. But I'll finish this. |
4c713dd
to
fffa694
Compare
I've force pushed a commit. It is rebased on master and contains the code for Windows as well, still limited to |
fffa694
to
733dfa9
Compare
src/sys/windows/tcp.rs
Outdated
}) | ||
.and_then(|socket| { | ||
// Required for a future `connect_overlapped` operation to be | ||
// executed successfully. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After the rewrite does this still apply?
After some trial and error this now works on Windows. Can some double check the code since I just developed it of the documentation and didn't run anything locally. |
66f37de
to
a39039e
Compare
I'm getting the |
cc @piscisaureus @PerfectLaugh ^^ We probably are missing a run_once call to WSAStartup? |
The WSAStartup should be already executed by std library.
Of course it would be exception of you don't import the std::net
…On Mon, Jul 22, 2019, 2:07 AM Carl Lerche ***@***.***> wrote:
cc @piscisaureus <https://github.com/piscisaureus> @PerfectLaugh
<https://github.com/PerfectLaugh> ^^
We probably are missing a run_once call to WSAStartup?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1029?email_source=notifications&email_token=AE43NARQCUGMLNU25B76RRLQASQVRA5CNFSM4IA422TKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2OITWA#issuecomment-513575384>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AE43NAS7HJFDNPRUK2X64GLQASQVRANCNFSM4IA422TA>
.
|
… On Mon, Jul 22, 2019, 2:11 AM PerfectLaugh ***@***.***> wrote:
The WSAStartup should be already executed by std library.
Of course it would be exception of you don't import the std::net
On Mon, Jul 22, 2019, 2:07 AM Carl Lerche ***@***.***>
wrote:
> cc @piscisaureus <https://github.com/piscisaureus> @PerfectLaugh
> <https://github.com/PerfectLaugh> ^^
>
> We probably are missing a run_once call to WSAStartup?
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <#1029?email_source=notifications&email_token=AE43NARQCUGMLNU25B76RRLQASQVRA5CNFSM4IA422TKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2OITWA#issuecomment-513575384>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AE43NAS7HJFDNPRUK2X64GLQASQVRANCNFSM4IA422TA>
> .
>
|
@PerfectLaugh How can we ensure it gets called? |
@Thomasdezeeuw In case you didn't know, you can run |
What is the test that throw error btw?
…On Mon, Jul 22, 2019, 2:33 AM Carl Lerche ***@***.***> wrote:
@PerfectLaugh <https://github.com/PerfectLaugh> How can we ensure it gets
called?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1029?email_source=notifications&email_token=AE43NAUUT462I2FOMLC74K3QASTWZA5CNFSM4IA422TKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2OJA7I#issuecomment-513577085>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AE43NAXJWEI2ESBHMRCCQILQASTWZANCNFSM4IA422TA>
.
|
I know, but I used |
@PerfectLaugh it looks like |
Seems that we need basically a function in |
Oh |
I think it is good to add that but notice the comment I added on #1041
#1041 (comment)
…On Mon, Jul 22, 2019, 2:40 AM Thomas de Zeeuw ***@***.***> wrote:
Oh TcpStream and TcpListener don't implement to/as/from_raw_socket, want
me to add that? Since I've already used it in a test.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1029?email_source=notifications&email_token=AE43NASLFK4ZXEN6DSPNQG3QASUQFA5CNFSM4IA422TKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2OJEMA#issuecomment-513577520>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AE43NATHYFPONPO3NSK63B3QASUQFANCNFSM4IA422TA>
.
|
Maybe we can do WSAStartup by ourselves? It is not bad to multiple call
this function to make sure the poll can work without tcp/udp
…On Mon, Jul 22, 2019, 2:43 AM PerfectLaugh ***@***.***> wrote:
I think it is good to add that but notice the comment I added on #1041
#1041 (comment)
On Mon, Jul 22, 2019, 2:40 AM Thomas de Zeeuw ***@***.***>
wrote:
> Oh TcpStream and TcpListener don't implement to/as/from_raw_socket, want
> me to add that? Since I've already used it in a test.
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <#1029?email_source=notifications&email_token=AE43NASLFK4ZXEN6DSPNQG3QASUQFA5CNFSM4IA422TKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2OJEMA#issuecomment-513577520>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AE43NATHYFPONPO3NSK63B3QASUQFANCNFSM4IA422TA>
> .
>
|
I've disabled |
@Thomasdezeeuw it seems ok to maintain a |
I've added a dummy listener to |
Same strategy as for the TCP types; using SOCK_NONBLOCK and SOCK_CLOEXEC where possible.
This ensures WSAStartup is called on Windows and initialised env_logger.
I forgot it...
2c1a3f2
to
dae8291
Compare
So I've an |
The standard library calls WSAStartup for us, ensuring (with an assert) that the return value is ok. This means that we can't initialise it ourselves and need to let the standard library do it for us. To work around this we create and drop a UdpSocket (from std::net).
This is now handled inside the crate.
I've added an |
@PerfectLaugh I can't request your review, but can you look at the Windows implementation? |
Looks good to me and have no issue of test in my computer. |
@asomers, @carllerche any chance you have some time to review this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
This initial comment only remove net2 from
TcpStream::connect
, on Unix platforms (expect for iOS, macOS and Solaris) this reduces the number of system calls from three to two.@carllerche this does increase the complexity a bit, do we still want to continue down this route?
Closes #841.
Closes #1045.