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

Allow a control message to contain multiple file descriptors (issue #566) #567

Merged

Conversation

Dretch
Copy link
Contributor

@Dretch Dretch commented Jul 29, 2023

ControlMessage has lost the Storable constraint, because it is not possible to implement Storable [Fd] because [Fd] is not fixed-size when encoded.

…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
Copy link
Contributor Author

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
Copy link
Contributor Author

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.

@kazu-yamamoto kazu-yamamoto self-requested a review July 30, 2023 05:11
@kazu-yamamoto
Copy link
Collaborator

I'm using this code now to see what happens in my projects.
Please wait for a while.

Copy link
Collaborator

@kazu-yamamoto kazu-yamamoto left a 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.

@kazu-yamamoto kazu-yamamoto merged commit 7c2c834 into haskell:master Aug 7, 2023
@Dretch Dretch deleted the issue-566-multiple-file-descriptors branch August 10, 2023 08:09
@andreasabel
Copy link
Member

Looks like this PR broke the Windows build:

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.

3 participants