aboutsummaryrefslogtreecommitdiff
path: root/libcmix-network
diff options
context:
space:
mode:
authorDennis Brentjes <d.brentjes@gmail.com>2016-10-20 12:44:18 +0200
committerDennis Brentjes <d.brentjes@gmail.com>2016-10-20 12:44:18 +0200
commit843c664d1da8cbe9a6aa5a7d49d827b30e22d9db (patch)
tree9fcac937ea4832945347c9d820f9c66f86d2c200 /libcmix-network
parented83ebb3147ed2e261a709799e12d0eb43200bf3 (diff)
downloadcmix-843c664d1da8cbe9a6aa5a7d49d827b30e22d9db.tar.gz
cmix-843c664d1da8cbe9a6aa5a7d49d827b30e22d9db.tar.bz2
cmix-843c664d1da8cbe9a6aa5a7d49d827b30e22d9db.zip
Set the "reuse address" option on the acceptor tcp socket.
Diffstat (limited to 'libcmix-network')
-rw-r--r--libcmix-network/acceptor.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/libcmix-network/acceptor.cpp b/libcmix-network/acceptor.cpp
index 896ed95..83406db 100644
--- a/libcmix-network/acceptor.cpp
+++ b/libcmix-network/acceptor.cpp
@@ -23,8 +23,12 @@ bool Acceptor::is_open() {
void Acceptor::listen_v6_and_v4_any() {
acceptor.open(endpoint.protocol());
- v6_only option(false);
- acceptor.set_option(option);
+
+ v6_only v6(false);
+ acceptor.set_option(v6);
+
+ boost::asio::socket_base::reuse_address reuse(true);
+ acceptor.set_option(reuse);
acceptor.bind(endpoint);
acceptor.listen();
@@ -33,6 +37,10 @@ void Acceptor::listen_v6_and_v4_any() {
void Acceptor::listen_socket()
{
acceptor.open(endpoint.protocol());
+
+ boost::asio::socket_base::reuse_address reuse(true);
+ acceptor.set_option(reuse);
+
acceptor.bind(endpoint);
acceptor.listen();
}