-
Notifications
You must be signed in to change notification settings - Fork 189
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
Allow a control message to contain multiple file descriptors (issue #566) #567
Allow a control message to contain multiple file descriptors (issue #566) #567
Conversation
…askell#566) ControlMessage has lost the Storable constraint, because it is not possible to implement Storable [Fd] because [Fd] is not fixed-size when encoded.
@@ -231,7 +231,7 @@ sendManyWithFds s bss fds = | |||
sendBufMsg s addr bufsizs cmsgs flags | |||
where | |||
addr = NullSockAddr | |||
cmsgs = encodeCmsg <$> fds | |||
cmsgs = encodeCmsg . (:[]) <$> fds |
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 could now send all the file descriptors in a single Cmsg
, but I left it this way to avoid changing the current behaviour.
Nothing -> return (-1) | ||
Just (Fd fd) -> return fd | ||
case (lookupCmsg CmsgIdFds cmsgs >>= decodeCmsg) :: Maybe [Fd] of | ||
Just (Fd fd : _) -> return fd |
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.
Same behaviour as before: take the first Fd
and ignore the others.
I'm using this code now to see what happens in my projects. |
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.
No bad things happened to me.
Let's merge this.
Looks like this PR broke the Windows build: |
ControlMessage has lost the Storable constraint, because it is not possible to implement Storable [Fd] because [Fd] is not fixed-size when encoded.