Commit 54fe2541 authored by Dominik Charousset's avatar Dominik Charousset

Treat OpenBSD like Linux, i.e., use MSG_NOSIGNAL

parent 8114fae3
...@@ -92,24 +92,19 @@ namespace network { ...@@ -92,24 +92,19 @@ namespace network {
const int ec_interrupted_syscall = EINTR; const int ec_interrupted_syscall = EINTR;
#endif #endif
// platform-dependent SIGPIPE setup // Platform-dependent setup for supressing SIGPIPE.
#if defined(CAF_MACOS) || defined(CAF_IOS) || defined(CAF_BSD) #if defined(CAF_MACOS) || defined(CAF_IOS) || defined(__FreeBSD__)
// Use the socket option but no flags to recv/send on macOS/iOS/BSD. // Set the SO_NOSIGPIPE socket option on macOS, iOS and FreeBSD.
// (OpenBSD doesn't have SO_NOSIGPIPE)
#ifndef __OpenBSD__
const int no_sigpipe_socket_flag = SO_NOSIGPIPE; const int no_sigpipe_socket_flag = SO_NOSIGPIPE;
#else
const int no_sigpipe_socket_flag = 0;
#endif
const int no_sigpipe_io_flag = 0; const int no_sigpipe_io_flag = 0;
#elif defined(CAF_WINDOWS) #elif defined(CAF_WINDOWS)
// Do nothing on Windows (SIGPIPE does not exist). // Do nothing on Windows (SIGPIPE does not exist).
const int no_sigpipe_socket_flag = 0; const int no_sigpipe_socket_flag = 0;
const int no_sigpipe_io_flag = 0; const int no_sigpipe_io_flag = 0;
#else #else
// Use flags to recv/send on Linux/Android but no socket option. // Pass MSG_NOSIGNAL to recv/send on Linux/Android/OpenBSD.
const int no_sigpipe_socket_flag = 0; const int no_sigpipe_socket_flag = 0;
const int no_sigpipe_io_flag = MSG_NOSIGNAL; const int no_sigpipe_io_flag = MSG_NOSIGNAL;
#endif #endif
#ifndef CAF_WINDOWS #ifndef CAF_WINDOWS
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment