From 9a2e38e058b1601bd8491de109312050a93d5f78 Mon Sep 17 00:00:00 2001 From: Alexandros Konstantinakis-Karmis Date: Mon, 27 Aug 2018 10:53:14 +0300 Subject: [PATCH 1/2] fix code for reuse addr on asio client --- src/asio_client_session_tcp_impl.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/asio_client_session_tcp_impl.cc b/src/asio_client_session_tcp_impl.cc index 13ac28cf..45eab8ce 100644 --- a/src/asio_client_session_tcp_impl.cc +++ b/src/asio_client_session_tcp_impl.cc @@ -40,7 +40,8 @@ session_tcp_impl::session_tcp_impl( const std::string &host, const std::string &service, const boost::posix_time::time_duration &connect_timeout) : session_impl(io_service, connect_timeout), - socket_(io_service, tcp::v4()) { + socket_(io_service) { + socket_.open(local_endpoint.protocol()); boost::asio::socket_base::reuse_address option(true); socket_.set_option(option); socket_.bind(local_endpoint); From 45acc922eb60a231a48ffd9216e21563db873753 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Mon, 27 Aug 2018 21:34:18 +0900 Subject: [PATCH 2/2] clang-format --- src/asio_client_session_tcp_impl.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/asio_client_session_tcp_impl.cc b/src/asio_client_session_tcp_impl.cc index 45eab8ce..8fdf2118 100644 --- a/src/asio_client_session_tcp_impl.cc +++ b/src/asio_client_session_tcp_impl.cc @@ -39,8 +39,7 @@ session_tcp_impl::session_tcp_impl( const boost::asio::ip::tcp::endpoint &local_endpoint, const std::string &host, const std::string &service, const boost::posix_time::time_duration &connect_timeout) - : session_impl(io_service, connect_timeout), - socket_(io_service) { + : session_impl(io_service, connect_timeout), socket_(io_service) { socket_.open(local_endpoint.protocol()); boost::asio::socket_base::reuse_address option(true); socket_.set_option(option);