face: move isListening()/size() to Channel as pure virtual methods
As a side effect, this ensures that Channel cannot be instantiated.
Change-Id: I875876ddf8fc0fbb04f3e88726c708ece8106702
diff --git a/daemon/face/tcp-channel.hpp b/daemon/face/tcp-channel.hpp
index 9038f59..400cdf9 100644
--- a/daemon/face/tcp-channel.hpp
+++ b/daemon/face/tcp-channel.hpp
@@ -56,6 +56,18 @@
explicit
TcpChannel(const tcp::Endpoint& localEndpoint);
+ bool
+ isListening() const override
+ {
+ return m_acceptor.is_open();
+ }
+
+ size_t
+ size() const override
+ {
+ return m_channelFaces.size();
+ }
+
/**
* \brief Enable listening on the local endpoint, accept connections,
* and create faces when remote host makes a connection
@@ -71,23 +83,14 @@
int backlog = boost::asio::ip::tcp::acceptor::max_connections);
/**
- * \brief Create a face by establishing connection to remote endpoint
+ * \brief Create a face by establishing a TCP connection to \p remoteEndpoint
*/
void
connect(const tcp::Endpoint& remoteEndpoint,
bool wantLocalFieldsEnabled,
const FaceCreatedCallback& onFaceCreated,
const FaceCreationFailedCallback& onConnectFailed,
- const time::seconds& timeout = time::seconds(4));
-
- /**
- * \brief Get number of faces in the channel
- */
- size_t
- size() const;
-
- bool
- isListening() const;
+ time::nanoseconds timeout = time::seconds(4));
private:
void
@@ -125,12 +128,6 @@
boost::asio::ip::tcp::socket m_acceptSocket;
};
-inline bool
-TcpChannel::isListening() const
-{
- return m_acceptor.is_open();
-}
-
} // namespace face
} // namespace nfd