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

fix(Network.Gopher): give client time to close client socket; refactor haskell-socket utilities #44

Merged
merged 3 commits into from Mar 15, 2021

Conversation

sternenseemann
Copy link
Owner

No description provided.

Move file descriptor conversion into top level bindings, throw
IOExceptions on errors and document them.

SystemdException no longer contains the invalid file descriptor
exception.
Mimic the behavior of 'close' in toFd: replace the old file descriptor
with (-1). This ensures that further calls on the 'Socket' are “safe” in
a sense as they won't block indefinetely. Instead they will throw an
exception as if close was called on the Socket.
After sending the response, we now send TCP FIN by calling shutdown(2)
on the socket. We then wait up to 1 second for the client to finish
reading and closing the socket on their end before finally closing the
socket on our side. This prevents read broken pipes for clients like
curl which would occasionally happen.

Resolves #42.
@sternenseemann sternenseemann merged commit 7e704eb into master Mar 15, 2021
@sternenseemann sternenseemann deleted the issue-42 branch March 15, 2021 00:47
@sternenseemann sternenseemann restored the issue-42 branch March 15, 2021 12:40
@sternenseemann sternenseemann deleted the issue-42 branch March 15, 2021 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant