Commit 8114fae3 authored by Douglas Carmichael's avatar Douglas Carmichael Committed by Dominik Charousset

OpenBSD compilation support.

parent 6e727d99
......@@ -209,6 +209,8 @@
# endif
#elif defined(__FreeBSD__)
# define CAF_BSD
#elif defined(__OpenBSD__)
# define CAF_BSD
#elif defined(__CYGWIN__)
# define CAF_CYGWIN
#elif defined(WIN32) || defined(_WIN32)
......
......@@ -290,8 +290,10 @@ bool interfaces::get_endpoint(const std::string& host, uint16_t port,
hint.ai_socktype = SOCK_DGRAM;
if (preferred)
hint.ai_family = *preferred == protocol::network::ipv4 ? AF_INET : AF_INET6;
#ifndef __OpenBSD__
if (hint.ai_family == AF_INET6)
hint.ai_flags = AI_V4MAPPED;
#endif
addrinfo* tmp = nullptr;
if (getaddrinfo(host.c_str(), port_hint, &hint, &tmp) != 0)
return false;
......
......@@ -94,9 +94,14 @@ namespace network {
// platform-dependent SIGPIPE setup
#if defined(CAF_MACOS) || defined(CAF_IOS) || defined(CAF_BSD)
// Use the socket option but no flags to recv/send on macOS/iOS/BSD.
const int no_sigpipe_socket_flag = SO_NOSIGPIPE;
const int no_sigpipe_io_flag = 0;
// Use the socket option but no flags to recv/send on macOS/iOS/BSD.
// (OpenBSD doesn't have SO_NOSIGPIPE)
#ifndef __OpenBSD__
const int no_sigpipe_socket_flag = SO_NOSIGPIPE;
#else
const int no_sigpipe_socket_flag = 0;
#endif
const int no_sigpipe_io_flag = 0;
#elif defined(CAF_WINDOWS)
// Do nothing on Windows (SIGPIPE does not exist).
const int no_sigpipe_socket_flag = 0;
......
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