fw: use Signal in FaceTable
refs #2272
Change-Id: I831963b8311c257178ad0da16d62e48b476bfee3
diff --git a/daemon/fw/face-table.hpp b/daemon/fw/face-table.hpp
index 70ceb11..435999e 100644
--- a/daemon/fw/face-table.hpp
+++ b/daemon/fw/face-table.hpp
@@ -29,8 +29,7 @@
#include "face/face.hpp"
#include <boost/range/adaptor/map.hpp>
-namespace nfd
-{
+namespace nfd {
class Forwarder;
@@ -73,16 +72,16 @@
const_iterator
end() const;
-public: // events
+public: // signals
/** \brief fires after a Face is added
*/
- EventEmitter<shared_ptr<Face> > onAdd;
+ signal::Signal<FaceTable, shared_ptr<Face>> onAdd;
/** \brief fires before a Face is removed
*
* FaceId is valid when this event is fired
*/
- EventEmitter<shared_ptr<Face> > onRemove;
+ signal::Signal<FaceTable, shared_ptr<Face>> onRemove;
private:
void
diff --git a/daemon/mgmt/face-manager.cpp b/daemon/mgmt/face-manager.cpp
index 03e2f42..6a7bb1e 100644
--- a/daemon/mgmt/face-manager.cpp
+++ b/daemon/mgmt/face-manager.cpp
@@ -124,6 +124,8 @@
ndn::KeyChain& keyChain)
: ManagerBase(face, FACE_MANAGER_PRIVILEGE, keyChain)
, m_faceTable(faceTable)
+ , m_faceAddConn(m_faceTable.onAdd.connect(bind(&FaceManager::onAddFace, this, _1)))
+ , m_faceRemoveConn(m_faceTable.onRemove.connect(bind(&FaceManager::onRemoveFace, this, _1)))
, m_faceStatusPublisher(m_faceTable, *m_face, FACES_LIST_DATASET_PREFIX, keyChain)
, m_channelStatusPublisher(m_factories, *m_face, CHANNELS_LIST_DATASET_PREFIX, keyChain)
, m_notificationStream(*m_face, FACE_EVENTS_PREFIX, keyChain)
@@ -137,9 +139,6 @@
{
face->setInterestFilter("/localhost/nfd/faces",
bind(&FaceManager::onFaceRequest, this, _2));
-
- m_faceTable.onAdd += bind(&FaceManager::onAddFace, this, _1);
- m_faceTable.onRemove += bind(&FaceManager::onRemoveFace, this, _1);
}
FaceManager::~FaceManager()
diff --git a/daemon/mgmt/face-manager.hpp b/daemon/mgmt/face-manager.hpp
index d4d979b..75477bf 100644
--- a/daemon/mgmt/face-manager.hpp
+++ b/daemon/mgmt/face-manager.hpp
@@ -173,6 +173,8 @@
private:
FaceTable& m_faceTable;
+ signal::ScopedConnection m_faceAddConn;
+ signal::ScopedConnection m_faceRemoveConn;
FaceStatusPublisher m_faceStatusPublisher;
ChannelStatusPublisher m_channelStatusPublisher;
NotificationStream<AppFace> m_notificationStream;