From 9a2e38e058b1601bd8491de109312050a93d5f78 Mon Sep 17 00:00:00 2001 From: Alexandros Konstantinakis-Karmis Date: Mon, 27 Aug 2018 10:53:14 +0300 Subject: [PATCH] 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);