From 56ed59334ff6f5c474e52967d2cbdf03dbb9b160 Mon Sep 17 00:00:00 2001 From: Simon Fels Date: Sun, 14 May 2017 12:59:08 +0200 Subject: [PATCH] Don't try to connect to host adb when timer is aborted --- src/anbox/qemu/adb_message_processor.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/anbox/qemu/adb_message_processor.cpp b/src/anbox/qemu/adb_message_processor.cpp index ad2e792..97135cb 100644 --- a/src/anbox/qemu/adb_message_processor.cpp +++ b/src/anbox/qemu/adb_message_processor.cpp @@ -132,7 +132,11 @@ void AdbMessageProcessor::wait_for_host_connection() { // Try again later when the host adb service is maybe available host_notify_timer_.cancel(); host_notify_timer_.expires_from_now(default_adb_wait_time); - host_notify_timer_.async_wait([&](const boost::system::error_code &) { wait_for_host_connection(); }); + host_notify_timer_.async_wait([this](const boost::system::error_code &err) { + if (err) + return; + wait_for_host_connection(); + }); } } @@ -156,8 +160,7 @@ void AdbMessageProcessor::on_host_connection(std::shared_ptrasync_receive_msg(callback, - boost::asio::buffer(host_buffer_)); + host_messenger_->async_receive_msg(callback, boost::asio::buffer(host_buffer_)); } void AdbMessageProcessor::on_host_read_size(const boost::system::error_code &error, std::size_t bytes_read) {