-
Notifications
You must be signed in to change notification settings - Fork 19
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
Don't require Unix in order to use mock sockets #74
Conversation
I believe my thinking at the time was that |
Well, you're right: |
|
@anmonteiro rebased on top of the latest changes. |
appreciate your patience here, give me a bit more time. |
Thanks! |
CHANGES: - gluten-lwt,gluten-eio: remove `Client.socket` ([anmonteiro/gluten#75](anmonteiro/gluten#75)) - gluten-eio: don't require `Eio_unix.stream_socket_ty`, allowing the use of mock sockets ([anmonteiro/gluten#74](anmonteiro/gluten#74))
Thanks for always being at the forefront and adapting to breaking changes in Eio's API!
After the Eio objects to variants migration, we weren't able to use an
Eio_mock.Net
network for tests anymore because commit 0c672bf changed the socket type in theClient
module fromEio.Flow.two_way
toEio_unix.Net.stream_socket_ty Eio.Net.stream_socket
.This is in contrast to the
Server
module where it's still_ Eio.Net.stream_socket
.As far as I can tell, there's no necessity for this restriction, so this PR changes it back and exposes
socket
asEio.Flow.two_way
again. ([ `Generic ] Eio.Net.stream_socket_ty Eio.Net.stream_socket
would also be possible and maybe more appropriate; I went withtwo_way
because that's what it was before.)However I don't know if there is any code that relies on it being Unix instead of the more generic type. I wasn't able to find any, but if this was a conscious choice maybe we can find a different way to allow for mock tests and still expose the socket (I refrained from adding a type parameter to
Client.t
for the network type but that would be one way, I guess).If you think this is change feasible, there's a one-line change in
h2
,httpaf
etc. needed as well so that they can also use mock networks again, along the lines of this commit. I can open those PRs but they only make sense in conjunction with this one.