diff options
Diffstat (limited to 'libcmix-network/connect.cpp')
| -rw-r--r-- | libcmix-network/connect.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/libcmix-network/connect.cpp b/libcmix-network/connect.cpp index 9df9b56..e80a6d4 100644 --- a/libcmix-network/connect.cpp +++ b/libcmix-network/connect.cpp @@ -6,6 +6,8 @@ #include <boost/asio/ip/address.hpp> #include <boost/asio/ssl.hpp> +#include <iostream> + using namespace boost::asio::ip; using namespace boost::asio; using boost::asio::io_service; @@ -69,8 +71,10 @@ void async_connect_iteration(basic_socket<tcp, stream_socket_service<tcp>>& sock info->retry_timer.expires_from_now(boost::posix_time::seconds(seconds_to_wait)); info->retry_timer.async_wait([&socket, info, on_connect](boost::system::error_code const& ec){ - if(ec) { - BOOST_LOG_TRIVIAL(error) << "Something went wrong with the retry timer: " << ec; + if(ec == boost::system::errc::operation_canceled) { + return; + } else if(ec) { + BOOST_LOG_TRIVIAL(error) << "Something went wrong with the retry timer: " << ec.message(); } else { async_connect_iteration(socket, info, on_connect); } @@ -83,9 +87,11 @@ void async_connect_iteration(basic_socket<tcp, stream_socket_service<tcp>>& sock } } else if(ec) { BOOST_LOG_TRIVIAL(info) << ec << std::endl; + info->retry_timer.cancel(); info->it++; async_connect_iteration(socket, info, on_connect); } else { + info->retry_timer.cancel(); on_connect(); } }; |
