aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2019-10-24 12:41:59 -0500
committerluigi1111 <luigi1111w@gmail.com>2019-10-24 12:41:59 -0500
commit42d84ad35eb4e20a4a50bfd55dabeb935c971992 (patch)
tree2b1c7dc5c40ac09dc7582b783a9679d9583c073f
parentMerge pull request #5998 (diff)
parentepee: use SO_REUSEADDR on non-Windows targets (diff)
downloadmonero-42d84ad35eb4e20a4a50bfd55dabeb935c971992.tar.xz
Merge pull request #6006
9f3be3b epee: use SO_REUSEADDR on non-Windows targets (xiphon)
-rw-r--r--contrib/epee/include/net/abstract_tcp_server2.inl8
1 files changed, 6 insertions, 2 deletions
diff --git a/contrib/epee/include/net/abstract_tcp_server2.inl b/contrib/epee/include/net/abstract_tcp_server2.inl
index e1777b1c4..5d12f9466 100644
--- a/contrib/epee/include/net/abstract_tcp_server2.inl
+++ b/contrib/epee/include/net/abstract_tcp_server2.inl
@@ -984,7 +984,9 @@ PRAGMA_WARNING_DISABLE_VS(4355)
boost::asio::ip::tcp::resolver::query query(address, boost::lexical_cast<std::string>(port), boost::asio::ip::tcp::resolver::query::canonical_name);
boost::asio::ip::tcp::endpoint endpoint = *resolver.resolve(query);
acceptor_.open(endpoint.protocol());
- acceptor_.set_option(boost::asio::ip::tcp::acceptor::linger(true, 0));
+#if !defined(_WIN32)
+ acceptor_.set_option(boost::asio::ip::tcp::acceptor::reuse_address(true));
+#endif
acceptor_.bind(endpoint);
acceptor_.listen();
boost::asio::ip::tcp::endpoint binded_endpoint = acceptor_.local_endpoint();
@@ -1018,7 +1020,9 @@ PRAGMA_WARNING_DISABLE_VS(4355)
boost::asio::ip::tcp::resolver::query query(address_ipv6, boost::lexical_cast<std::string>(port_ipv6), boost::asio::ip::tcp::resolver::query::canonical_name);
boost::asio::ip::tcp::endpoint endpoint = *resolver.resolve(query);
acceptor_ipv6.open(endpoint.protocol());
- acceptor_ipv6.set_option(boost::asio::ip::tcp::acceptor::linger(true, 0));
+#if !defined(_WIN32)
+ acceptor_ipv6.set_option(boost::asio::ip::tcp::acceptor::reuse_address(true));
+#endif
acceptor_ipv6.set_option(boost::asio::ip::v6_only(true));
acceptor_ipv6.bind(endpoint);
acceptor_ipv6.listen();