-
Notifications
You must be signed in to change notification settings - Fork 186
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 SockOptValue
and setSockOptValue
#588
Add SockOptValue
and setSockOptValue
#588
Conversation
The existing interface did not allow one to set both `Linger` and `NoDelay` socket options. With the `SocketOptionValue` introduced in [this `network` PR](haskell/network#588), this is now possible.
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.
I think that setSocketOptionValue
is an extended version of setSockOpt
.
So, the name should be setSockOptValue
and SockOptValue
.
The export list should be setSockOpt
, SockOptValue
and setSockOptValue
in order.
3893a87
to
2c2a445
Compare
That makes sense to me, I've updated this! |
2c2a445
to
39d6b8d
Compare
The existing interface did not allow one to set both `Linger` and `NoDelay` socket options. With the `SocketOptValue` introduced in [this `network` PR](haskell/network#588), this is now possible.
Network/Socket/Options.hsc
Outdated
@@ -481,6 +500,12 @@ instance Storable StructLinger where | |||
(#poke struct linger, l_linger) p linger | |||
#endif | |||
|
|||
-- | Existential socket option value |
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.
I feel that "existential" is too academic to understand for many users.
How about this?
"A data type to hold several different socket option types such as Int and StructLinger".
Please feel free to fix my broken English.
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.
Ah yes, thanks, I was also a bit worried about that. What you wrote sounds great, I'll update this!
39d6b8d
to
85a4b71
Compare
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.
I'm sorry for not noticing this yesterday.
Socket
should be Sock
.
I will merge this PR with this modifications.
85a4b71
to
da15ef8
Compare
Whoops, sorry about that. Fixed! |
See docs for `setSockOptValue`
da15ef8
to
f0b472e
Compare
SocketOptionValue
and setSocketOptionValue
SockOptValue
and setSockOptValue
The existing interface did not allow one to set both `Linger` and `NoDelay` socket options. With the `SockOptValue` introduced in [this `network` PR](haskell/network#588), this is now possible.
Merged. |
Looks good to me, thank you! |
A new version has been released. |
The motivation for this is to enable an interface in
network-run
similar to theopen{Client,Server,TCPServer}SocketWithOptions
that allows users to set multiple socket option values of potentially different value types, e.g.NoDelay
andLinger
. See the corresponding PR innetwork-run