Fix compilation with Boost 1.70.0

Refs: #4923
Change-Id: Ic0cb78586cee1ad5e527f7d2a23fd2e1bdbd0bcb
diff --git a/ndn-cxx/net/dns.cpp b/ndn-cxx/net/dns.cpp
index 9942867..c3e04b1 100644
--- a/ndn-cxx/net/dns.cpp
+++ b/ndn-cxx/net/dns.cpp
@@ -24,6 +24,9 @@
 
 #include <boost/asio/io_service.hpp>
 #include <boost/asio/ip/udp.hpp>
+#if BOOST_VERSION >= 106600
+#include <boost/asio/post.hpp>
+#endif
 
 namespace ndn {
 namespace dns {
@@ -72,8 +75,13 @@
                   iterator it, const shared_ptr<Resolver>& self)
   {
     m_resolveTimeout.cancel();
+
     // ensure the Resolver isn't destructed while callbacks are still pending, see #2653
+#if BOOST_VERSION >= 106600
+    boost::asio::post(m_resolver.get_executor(), [self] {});
+#else
     m_resolver.get_io_service().post([self] {});
+#endif
 
     if (error) {
       if (error == boost::asio::error::operation_aborted)
@@ -99,8 +107,13 @@
   onResolveTimeout(const shared_ptr<Resolver>& self)
   {
     m_resolver.cancel();
+
     // ensure the Resolver isn't destructed while callbacks are still pending, see #2653
+#if BOOST_VERSION >= 106600
+    boost::asio::post(m_resolver.get_executor(), [self] {});
+#else
     m_resolver.get_io_service().post([self] {});
+#endif
 
     if (m_onError)
       m_onError("Hostname resolution timed out");
diff --git a/ndn-cxx/transport/detail/stream-transport-impl.hpp b/ndn-cxx/transport/detail/stream-transport-impl.hpp
index 944b743..a90143a 100644
--- a/ndn-cxx/transport/detail/stream-transport-impl.hpp
+++ b/ndn-cxx/transport/detail/stream-transport-impl.hpp
@@ -24,7 +24,7 @@
 
 #include "ndn-cxx/transport/transport.hpp"
 
-#include <boost/asio/deadline_timer.hpp>
+#include <boost/asio/steady_timer.hpp>
 #include <boost/asio/write.hpp>
 
 #include <list>
@@ -62,11 +62,15 @@
 
       // Wait at most 4 seconds to connect
       /// @todo Decide whether this number should be configurable
-      m_connectTimer.expires_from_now(boost::posix_time::seconds(4));
-      m_connectTimer.async_wait(bind(&Impl::connectTimeoutHandler, this->shared_from_this(), _1));
+      m_connectTimer.expires_from_now(std::chrono::seconds(4));
+      m_connectTimer.async_wait([self = this->shared_from_this()] (const auto& error) {
+        self->connectTimeoutHandler(error);
+      });
 
       m_socket.open();
-      m_socket.async_connect(endpoint, bind(&Impl::connectHandler, this->shared_from_this(), _1));
+      m_socket.async_connect(endpoint, [self = this->shared_from_this()] (const auto& error) {
+        self->connectHandler(error);
+      });
     }
   }
 
@@ -275,7 +279,7 @@
   TransmissionQueue m_transmissionQueue;
   bool m_isConnecting;
 
-  boost::asio::deadline_timer m_connectTimer;
+  boost::asio::steady_timer m_connectTimer;
 };
 
 } // namespace detail
diff --git a/ndn-cxx/transport/detail/stream-transport-with-resolver-impl.hpp b/ndn-cxx/transport/detail/stream-transport-with-resolver-impl.hpp
index 986eb57..a59e873 100644
--- a/ndn-cxx/transport/detail/stream-transport-with-resolver-impl.hpp
+++ b/ndn-cxx/transport/detail/stream-transport-with-resolver-impl.hpp
@@ -34,8 +34,6 @@
 class StreamTransportWithResolverImpl : public StreamTransportImpl<BaseTransport, Protocol>
 {
 public:
-  using Impl = StreamTransportWithResolverImpl<BaseTransport,Protocol>;
-
   StreamTransportWithResolverImpl(BaseTransport& transport, boost::asio::io_service& ioService)
     : StreamTransportImpl<BaseTransport, Protocol>(transport, ioService)
   {
@@ -47,16 +45,25 @@
     if (this->m_isConnecting) {
       return;
     }
-
     this->m_isConnecting = true;
 
     // Wait at most 4 seconds to connect
     /// @todo Decide whether this number should be configurable
-    this->m_connectTimer.expires_from_now(boost::posix_time::seconds(4));
-    this->m_connectTimer.async_wait(bind(&Impl::connectTimeoutHandler, this->shared_from_this(), _1));
+    this->m_connectTimer.expires_from_now(std::chrono::seconds(4));
+    this->m_connectTimer.async_wait([self = this->shared_from_base()] (const auto& ec) {
+      self->connectTimeoutHandler(ec);
+    });
 
-    auto resolver = make_shared<typename Protocol::resolver>(ref(this->m_socket.get_io_service()));
-    resolver->async_resolve(query, bind(&Impl::resolveHandler, this->shared_from_base(), _1, _2, resolver));
+    auto resolver = make_shared<typename Protocol::resolver>(this->m_socket
+#if BOOST_VERSION >= 107000
+                                                             .get_executor()
+#else
+                                                             .get_io_service()
+#endif
+                                                             );
+    resolver->async_resolve(query, [self = this->shared_from_base(), resolver] (auto&&... args) {
+      self->resolveHandler(std::forward<decltype(args)>(args)..., resolver);
+    });
   }
 
 protected:
@@ -78,10 +85,14 @@
       NDN_THROW(Transport::Error(error, "Unable to resolve host or port"));
     }
 
-    this->m_socket.async_connect(*endpoint, bind(&Impl::connectHandler, this->shared_from_this(), _1));
+    this->m_socket.async_connect(*endpoint, [self = this->shared_from_base()] (const auto& ec) {
+      self->connectHandler(ec);
+    });
   }
 
 private:
+  using Impl = StreamTransportWithResolverImpl<BaseTransport, Protocol>;
+
   shared_ptr<Impl>
   shared_from_base()
   {
diff --git a/ndn-cxx/util/scheduler.hpp b/ndn-cxx/util/scheduler.hpp
index 8e2e7fb..ed81a03 100644
--- a/ndn-cxx/util/scheduler.hpp
+++ b/ndn-cxx/util/scheduler.hpp
@@ -183,7 +183,7 @@
   void
   cancelImpl(const shared_ptr<EventInfo>& info);
 
-  /** \brief Schedule the next event on the deadline timer
+  /** \brief Schedule the next event on the internal timer
    */
   void
   scheduleNext();