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/udp-channel.hpp b/daemon/face/udp-channel.hpp
index b9b71a8..fe849a6 100644
--- a/daemon/face/udp-channel.hpp
+++ b/daemon/face/udp-channel.hpp
@@ -51,11 +51,17 @@
UdpChannel(const udp::Endpoint& localEndpoint,
const time::seconds& timeout);
- /**
- * \brief Get number of faces in the channel
- */
+ bool
+ isListening() const override
+ {
+ return m_socket.is_open();
+ }
+
size_t
- size() const;
+ size() const override
+ {
+ return m_channelFaces.size();
+ }
/**
* \brief Create a face by establishing connection to remote endpoint
@@ -84,9 +90,6 @@
listen(const FaceCreatedCallback& onFaceCreated,
const FaceCreationFailedCallback& onReceiveFailed);
- bool
- isListening() const;
-
private:
void
waitForNewPeer(const FaceCreatedCallback& onFaceCreated,
@@ -128,12 +131,6 @@
uint8_t m_inputBuffer[ndn::MAX_NDN_PACKET_SIZE];
};
-inline bool
-UdpChannel::isListening() const
-{
- return m_socket.is_open();
-}
-
} // namespace face
} // namespace nfd