From ad338bfa4470898ec8d7a3024625cd03dce50bca Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Fri, 31 Mar 2017 21:17:57 +0900 Subject: [PATCH] asio: Fix crash if connect takes longer time than ping interval --- src/asio_client_session_impl.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/asio_client_session_impl.cc b/src/asio_client_session_impl.cc index 067616e7..ac7b4a89 100644 --- a/src/asio_client_session_impl.cc +++ b/src/asio_client_session_impl.cc @@ -84,7 +84,6 @@ void session_impl::start_resolve(const std::string &host, }); deadline_.async_wait(std::bind(&session_impl::handle_deadline, self)); - start_ping(); } void session_impl::handle_deadline() { @@ -135,6 +134,8 @@ void session_impl::connected(tcp::resolver::iterator endpoint_it) { do_write(); do_read(); + start_ping(); + auto &connect_cb = on_connect(); if (connect_cb) { connect_cb(endpoint_it);