face: Stop using shared_ptr to manage acceptors

This commit also includes a major cleanup of all channels.

Change-Id: I10db9709e0cba6a0691a86482c60b5dbb2956f68
Refs: #2613
diff --git a/daemon/face/unix-stream-channel.hpp b/daemon/face/unix-stream-channel.hpp
index c923c39..c90dcb0 100644
--- a/daemon/face/unix-stream-channel.hpp
+++ b/daemon/face/unix-stream-channel.hpp
@@ -26,7 +26,6 @@
 #define NFD_DAEMON_FACE_UNIX_STREAM_CHANNEL_HPP
 
 #include "channel.hpp"
-#include "unix-stream-face.hpp"
 
 namespace nfd {
 
@@ -60,8 +59,7 @@
   explicit
   UnixStreamChannel(const unix_stream::Endpoint& endpoint);
 
-  virtual
-  ~UnixStreamChannel();
+  ~UnixStreamChannel() DECL_OVERRIDE;
 
   /**
    * \brief Enable listening on the local endpoint, accept connections,
@@ -77,19 +75,31 @@
          const ConnectFailedCallback& onAcceptFailed,
          int backlog = boost::asio::local::stream_protocol::acceptor::max_connections);
 
-private:
-  void
-  handleSuccessfulAccept(const boost::system::error_code& error,
-                         const shared_ptr<boost::asio::local::stream_protocol::socket>& socket,
-                         const FaceCreatedCallback& onFaceCreated,
-                         const ConnectFailedCallback& onConnectFailed);
+  bool
+  isListening() const;
 
 private:
+  void
+  accept(const FaceCreatedCallback& onFaceCreated,
+         const ConnectFailedCallback& onAcceptFailed);
+
+  void
+  handleAccept(const boost::system::error_code& error,
+               const shared_ptr<boost::asio::local::stream_protocol::socket>& socket,
+               const FaceCreatedCallback& onFaceCreated,
+               const ConnectFailedCallback& onAcceptFailed);
+
+private:
+  boost::asio::local::stream_protocol::acceptor m_acceptor;
   unix_stream::Endpoint m_endpoint;
-  shared_ptr<boost::asio::local::stream_protocol::acceptor> m_acceptor;
-  bool m_isListening;
 };
 
+inline bool
+UnixStreamChannel::isListening() const
+{
+  return m_acceptor.is_open();
+}
+
 } // namespace nfd
 
 #endif // NFD_DAEMON_FACE_UNIX_STREAM_CHANNEL_HPP