daemon: use asio::defer() instead of asio::post() where appropriate
Change-Id: I24d0fab6499d6430dd500ca157daa87f48960d15
diff --git a/daemon/face/ethernet-transport.cpp b/daemon/face/ethernet-transport.cpp
index a1c23f2..a76b0b6 100644
--- a/daemon/face/ethernet-transport.cpp
+++ b/daemon/face/ethernet-transport.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2022, Regents of the University of California,
+ * Copyright (c) 2014-2023, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -29,6 +29,7 @@
#include <pcap/pcap.h>
+#include <boost/asio/defer.hpp>
#include <boost/endian/conversion.hpp>
namespace nfd::face {
@@ -87,7 +88,7 @@
// Ensure that the Transport stays alive at least
// until all pending handlers are dispatched
- getGlobalIoService().post([this] {
+ boost::asio::defer(getGlobalIoService(), [this] {
this->setState(TransportState::CLOSED);
});
}