Skip to content

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

Merged
kazu-yamamoto merged 1 commit into
haskell:masterfrom
Dretch:issue-566-multiple-file-descriptors
Aug 7, 2023
Merged

Allow a control message to contain multiple file descriptors (issue #566)#567
kazu-yamamoto merged 1 commit into
haskell:masterfrom
Dretch:issue-566-multiple-file-descriptors

Conversation

@Dretch

@Dretch Dretch commented Jul 29, 2023

Copy link
Copy Markdown
Contributor

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

)

ControlMessage has lost the Storable constraint, because it is not possible to implement Storable [Fd] because [Fd] is not fixed-size when encoded.
where
addr = NullSockAddr
cmsgs = encodeCmsg <$> fds
cmsgs = encodeCmsg . (:[]) <$> fds

Copy link
Copy Markdown
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.

Comment thread Network/Socket/Unix.hsc
Nothing -> return (-1)
Just (Fd fd) -> return fd
case (lookupCmsg CmsgIdFds cmsgs >>= decodeCmsg) :: Maybe [Fd] of
Just (Fd fd : _) -> return fd

Copy link
Copy Markdown
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
Copy Markdown
Collaborator

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

@kazu-yamamoto kazu-yamamoto left a comment

Copy link
Copy Markdown
Collaborator

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
Copy Markdown
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