face: replace EventEmitter usage with Signal
refs #2300
Change-Id: I17d0d65d2c474b17dd9f23f271a6144b0b4fbc07
diff --git a/daemon/fw/face-table.cpp b/daemon/fw/face-table.cpp
index f1db53b..71a7cf6 100644
--- a/daemon/fw/face-table.cpp
+++ b/daemon/fw/face-table.cpp
@@ -85,12 +85,9 @@
NFD_LOG_INFO("Added face id=" << faceId << " remote=" << face->getRemoteUri()
<< " local=" << face->getLocalUri());
- face->onReceiveInterest += bind(&Forwarder::onInterest,
- &m_forwarder, ref(*face), _1);
- face->onReceiveData += bind(&Forwarder::onData,
- &m_forwarder, ref(*face), _1);
- face->onFail += bind(&FaceTable::remove,
- this, face);
+ face->onReceiveInterest.connect(bind(&Forwarder::onInterest, &m_forwarder, ref(*face), _1));
+ face->onReceiveData.connect(bind(&Forwarder::onData, &m_forwarder, ref(*face), _1));
+ face->onFail.connectSingleShot(bind(&FaceTable::remove, this, face));
this->onAdd(face);
}
@@ -104,15 +101,7 @@
m_faces.erase(faceId);
face->setId(INVALID_FACEID);
NFD_LOG_INFO("Removed face id=" << faceId << " remote=" << face->getRemoteUri() <<
- " local=" << face->getLocalUri());
-
- // XXX This clears all subscriptions, because EventEmitter
- // does not support only removing Forwarder's subscription
- face->onReceiveInterest.clear();
- face->onReceiveData .clear();
- face->onSendInterest .clear();
- face->onSendData .clear();
- // don't clear onFail because other functions may need to execute
+ " local=" << face->getLocalUri());
m_forwarder.getFib().removeNextHopFromAllEntries(face);
}