Skip to content

Shutdown err handling#419

Merged
cperciva merged 2 commits intomasterfrom
shutdown-err-handling
Mar 26, 2025
Merged

Shutdown err handling#419
cperciva merged 2 commits intomasterfrom
shutdown-err-handling

Conversation

@cperciva
Copy link
Member

No description provided.

Code refactoring; no functional change.
@cperciva cperciva requested a review from gperciva March 24, 2025 22:55
@gperciva
Copy link
Member

Added a REBASE commit which added some comments.

Per POSIX, the shutdown(2) system call can fail with EBADF, EINVAL,
ENOTSOCK, and ENOTCONN.  Of these, the first three should never occur
in spiped -- they indicate that we somehow got confused about file
descriptors and we should terminate.  ENOTCONN is harmless at this
point since it indicates that a connection has been closed where we
no longer wanted to send any traffic anyway.

But POSIX does not prohibit other error codes from being returned;
and FreeBSD returns ECONNRESET upon attempting to shutdown a closed
TCP connection.  Accept this as harmless as well; and treat any other
errors as being fatal *for this pipe* but do not abort spiped.
@cperciva cperciva force-pushed the shutdown-err-handling branch from c311fef to 1e0aebb Compare March 26, 2025 04:02
@cperciva
Copy link
Member Author

I changed the comments, but thanks for pointing out that I needed to add some.

@cperciva cperciva merged commit 36e7f41 into master Mar 26, 2025
2 checks passed
@gperciva gperciva deleted the shutdown-err-handling branch March 26, 2025 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants