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/websocket-channel.hpp b/daemon/face/websocket-channel.hpp
index f7c6ae2..f560ab3 100644
--- a/daemon/face/websocket-channel.hpp
+++ b/daemon/face/websocket-channel.hpp
@@ -27,34 +27,17 @@
#define NFD_DAEMON_FACE_WEBSOCKET_CHANNEL_HPP
#include "channel.hpp"
-#include "core/global-io.hpp"
-#include "core/scheduler.hpp"
#include "websocket-face.hpp"
namespace nfd {
/**
* \brief Class implementing WebSocket-based channel to create faces
- *
- *
*/
class WebSocketChannel : public Channel
{
public:
/**
- * \brief Exception of WebSocketChannel
- */
- class Error : public std::runtime_error
- {
- public:
- explicit
- Error(const std::string& what)
- : runtime_error(what)
- {
- }
- };
-
- /**
* \brief Create WebSocket channel for the local endpoint
*
* To enable creation of faces upon incoming connections,
@@ -66,9 +49,6 @@
explicit
WebSocketChannel(const websocket::Endpoint& localEndpoint);
- virtual
- ~WebSocketChannel();
-
/**
* \brief Enable listening on the local endpoint, accept connections,
* and create faces when remote host makes a connection
@@ -88,11 +68,9 @@
bool
isListening() const;
+PUBLIC_WITH_TESTS_ELSE_PRIVATE:
void
- setPingInterval(time::milliseconds interval)
- {
- m_pingInterval = interval;
- }
+ setPingInterval(time::milliseconds interval);
void
setPongTimeout(time::milliseconds timeout);
@@ -118,20 +96,16 @@
private:
websocket::Endpoint m_localEndpoint;
-
websocket::Server m_server;
+ std::map<websocketpp::connection_hdl, shared_ptr<WebSocketFace>,
+ std::owner_less<websocketpp::connection_hdl>> m_channelFaces;
+
/**
- * Callbacks for face creation.
- * New communications are detected using async_receive_from.
- * Its handler has a fixed signature. No space for the face callback
+ * Callback for face creation
*/
FaceCreatedCallback m_onFaceCreatedCallback;
- typedef std::map< websocketpp::connection_hdl, shared_ptr<WebSocketFace>,
- std::owner_less<websocketpp::connection_hdl> > ChannelFaceMap;
- ChannelFaceMap m_channelFaces;
-
/**
* \brief If true, it means the function listen has already been called
*/