daemon: use asio::defer() instead of asio::post() where appropriate
Change-Id: I24d0fab6499d6430dd500ca157daa87f48960d15
diff --git a/daemon/face/tcp-transport.cpp b/daemon/face/tcp-transport.cpp
index 45bc952..15c0769 100644
--- a/daemon/face/tcp-transport.cpp
+++ b/daemon/face/tcp-transport.cpp
@@ -26,6 +26,8 @@
#include "tcp-transport.hpp"
#include "common/global.hpp"
+#include <boost/asio/defer.hpp>
+
#if defined(__linux__)
#include <linux/sockios.h>
#include <sys/ioctl.h>
@@ -105,7 +107,7 @@
m_socket.cancel(ec);
// do this asynchronously because there could be some callbacks still pending
- getGlobalIoService().post([this] { reconnect(); });
+ boost::asio::defer(getGlobalIoService(), [this] { reconnect(); });
}
else {
StreamTransport::handleError(error);
@@ -175,7 +177,7 @@
MAX_RECONNECT_DELAY);
// do this asynchronously because there could be some callbacks still pending
- getGlobalIoService().post([this] { reconnect(); });
+ boost::asio::defer(getGlobalIoService(), [this] { reconnect(); });
}
void