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

Work around historical behavioural oddity with UNIX domain sockets #460

Closed
wants to merge 3 commits into from

Conversation

infinity0
Copy link
Contributor

Originally part of #428. Hopefully the code & commit messages should be self-explanatory. TD;LR version is that bind doesn't clean up after itself, this works around that.

Network/Socket/SockAddr.hs Outdated Show resolved Hide resolved
res <- try (G.bind s a)
case res of
Right () -> pure ()
Left e -> if not (isAlreadyInUseError (e :: IOException))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't you use | isAlreadyInUseError (e :: IOException) instead of if.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 8d5ff8d - though I've kept the error conditions grouped together at the top as I think that's visually easier to read, hope that's OK.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't forget pure in tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

woops, also done now in f27b87c

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.

LGTM

kazu-yamamoto added a commit to kazu-yamamoto/network that referenced this pull request May 25, 2020
@kazu-yamamoto
Copy link
Collaborator

Rebased and merged. Thank you for your contribution!

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.

2 participants