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

Add into_std methods to structs with from_std methods #1401

Closed
wants to merge 1 commit into from

Conversation

stevenroose
Copy link

It seems useful to have those.

@Thomasdezeeuw
Copy link
Collaborator

I don't think this is a good idea since the type in standard lib are generally consider blocking, while Mio's types are generally considered non-blocking.

@stevenroose
Copy link
Author

I don't think this is a good idea since the type in standard lib are generally consider blocking, while Mio's types are generally considered non-blocking.

Well the same is true for from_std, right? And there's a disclaimer about that on from_std, so I also added a disclaimer about that on into_std. I can make the disclaimer a bit more explicit about the non-blocking state?

@stevenroose
Copy link
Author

About the CI failure, it seems like it's unrelated. I don't get it locally, but I occasionally get other failures.

@Thomasdezeeuw
Copy link
Collaborator

Yeah it's a known problem: #1376, I've restarted the CI.

@Thomasdezeeuw
Copy link
Collaborator

Well the same is true for from_std, right?

That's true.

And there's a disclaimer about that on from_std, so I also added a disclaimer about that on into_std. I can make the disclaimer a bit more explicit about the non-blocking state?

The problem with going Mio -> std, is that Mio keeps some additional state (on Windows) that will get lost. For everything to guarantee to work correctly you would need to deregister before calling into_std. And register when doing the inverse again, i.e. from_std.

Can you add two tests for each type:

  1. A tests that creates a Mio TcpStream/UdpSocket/etc. register it with Poll. Create an event for it (accept the stream/send a packet etc.). Next deregister it and call into_std. Then check that we get no events for the type (you can use expect_no_events for this).
  2. Basically the same as above, create Mio type, register, create event, deregister and call into_std. But then call from_std and register it again. After that poll and we would expect to get an event (but I'm not 100% sure this will be the case).

@Thomasdezeeuw
Copy link
Collaborator

@stevenroose do you plan on continuing this?

@Thomasdezeeuw
Copy link
Collaborator

Closing this due to inactivity.

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