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

Disable SIGPIPE on sockets (Issue #23) #24

Merged
merged 2 commits into from
Jun 6, 2012
Merged

Disable SIGPIPE on sockets (Issue #23) #24

merged 2 commits into from
Jun 6, 2012

Conversation

alanxz
Copy link
Owner

@alanxz alanxz commented Jun 6, 2012

See Issue #23

Disable SIGPIPE signaling on sockets owned by the library by setting MSG_NOSIGNAL on linux and SO_NOSIGPIPE on BSD variants, Win32 doesn't have SIGPIPE its ignored.

Not using the signal(SIGPIPE, SIG_IGN) as that affects the entire process and a process may have other pipes it wants to be signaled on.

Use setsockopt(SO_NOSIGPIPE) on platforms that don't have MSG_NOSIGNAL
and do have SO_NOSIGPIPE
alanxz added a commit that referenced this pull request Jun 6, 2012
Disable SIGPIPE on sockets (Issue #23)
@alanxz alanxz merged commit 42e3f34 into master Jun 6, 2012
# define MSG_NOSIGNAL 0x0
#endif

#if defined(SO_NOSIGPIPE) && !defined(MSG_NOSIGNAL)

Choose a reason for hiding this comment

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

This condition is never true: MSG_NOSIGNAL is always defined because of the lines 58-60.

Lines 58-60 should be after this test.

@thomas-riccardi
Copy link

On MacOSX the process sometimes receives SIGPIPES. They disappear if we manually set SO_NOSIGPIPE with setsockopt() on the socketfd.

version 0.3.0

@alanxz
Copy link
Owner Author

alanxz commented Mar 5, 2013

@triccardi-systran - good catch. I've opened a new issue #102 to track this bug.

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.

None yet

2 participants