From 50ac462471feddd82dd395c284b469fd2e44c06b Mon Sep 17 00:00:00 2001 From: Eric Frias Date: Wed, 14 May 2014 16:02:41 -0400 Subject: [PATCH] Enable SO_REUSEPORT on Linux as well as OS X --- src/network/tcp_socket.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/network/tcp_socket.cpp b/src/network/tcp_socket.cpp index b1a6dbe..c4b0e11 100644 --- a/src/network/tcp_socket.cpp +++ b/src/network/tcp_socket.cpp @@ -136,7 +136,7 @@ namespace fc { FC_ASSERT(my->_sock.is_open()); boost::asio::socket_base::reuse_address option(enable); my->_sock.set_option(option); -#if defined(__APPLE__) +#if defined(__APPLE__) || (defined(__linux__) && defined(SO_REUSEPORT)) // OSX needs SO_REUSEPORT in addition to SO_REUSEADDR. // This probably needs to be set for any BSD int reuseport_value = 1; @@ -195,7 +195,7 @@ namespace fc { my = new impl; boost::asio::ip::tcp::acceptor::reuse_address option(enable); my->_accept.set_option(option); -#if defined(__APPLE__) +#if defined(__APPLE__) || (defined(__linux__) && defined(SO_REUSEPORT)) // OSX needs SO_REUSEPORT in addition to SO_REUSEADDR. // This probably needs to be set for any BSD int reuseport_value = 1;