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/unix-stream-channel.cpp b/daemon/face/unix-stream-channel.cpp
index e09cd98..b253a70 100644
--- a/daemon/face/unix-stream-channel.cpp
+++ b/daemon/face/unix-stream-channel.cpp
@@ -40,6 +40,7 @@
: m_endpoint(endpoint)
, m_acceptor(getGlobalIoService())
, m_socket(getGlobalIoService())
+ , m_size(0)
{
setUri(FaceUri(m_endpoint));
}
@@ -136,6 +137,10 @@
auto linkService = make_unique<GenericLinkService>();
auto transport = make_unique<UnixStreamTransport>(std::move(m_socket));
auto face = make_shared<Face>(std::move(linkService), std::move(transport));
+
+ ++m_size;
+ connectFaceClosedSignal(*face, [this] { --m_size; });
+
onFaceCreated(face);
// prepare accepting the next connection