asio: Fix crash if connect takes longer time than ping interval
This commit is contained in:
parent
a629a0c677
commit
d2ba169f79
|
@ -84,7 +84,6 @@ void session_impl::start_resolve(const std::string &host,
|
||||||
});
|
});
|
||||||
|
|
||||||
deadline_.async_wait(std::bind(&session_impl::handle_deadline, self));
|
deadline_.async_wait(std::bind(&session_impl::handle_deadline, self));
|
||||||
start_ping();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void session_impl::handle_deadline() {
|
void session_impl::handle_deadline() {
|
||||||
|
@ -135,6 +134,8 @@ void session_impl::connected(tcp::resolver::iterator endpoint_it) {
|
||||||
do_write();
|
do_write();
|
||||||
do_read();
|
do_read();
|
||||||
|
|
||||||
|
start_ping();
|
||||||
|
|
||||||
auto &connect_cb = on_connect();
|
auto &connect_cb = on_connect();
|
||||||
if (connect_cb) {
|
if (connect_cb) {
|
||||||
connect_cb(endpoint_it);
|
connect_cb(endpoint_it);
|
||||||
|
|
Loading…
Reference in New Issue