face: pass addFace and NetworkMonitor to ProtocolFactory constructor
refs #4021 Change-Id: I842515eb044bb1c655b347e6069e63c55c4e2d54
This commit is contained in:
1 parent
2d49175d6e
commit
0ba6d64e5a
22 files changed
+162
-97
No files matched your search
@@ -33,18 +33,24 @@ namespace face {
|
||||
|
||||
NFD_LOG_INIT("FaceSystem");
|
||||
|
||||
FaceSystem::FaceSystem(FaceTable& faceTable, const shared_ptr<ndn::net::NetworkMonitor>& netmon)
|
||||
FaceSystem::FaceSystem(FaceTable& faceTable, shared_ptr<ndn::net::NetworkMonitor> netmon)
|
||||
: m_faceTable(faceTable)
|
||||
, m_netmon(std::move(netmon))
|
||||
{
|
||||
BOOST_ASSERT(netmon != nullptr);
|
||||
|
||||
auto addFace = bind(&FaceTable::add, &m_faceTable, _1);
|
||||
auto pfCtorParams = this->makePFCtorParams();
|
||||
for (const std::string& id : ProtocolFactory::listRegistered()) {
|
||||
NFD_LOG_TRACE("creating factory " << id);
|
||||
m_factories[id] = ProtocolFactory::create(id, netmon, addFace);
|
||||
m_factories[id] = ProtocolFactory::create(id, pfCtorParams);
|
||||
}
|
||||
}
|
||||
|
||||
ProtocolFactoryCtorParams
|
||||
FaceSystem::makePFCtorParams()
|
||||
{
|
||||
auto addFace = bind(&FaceTable::add, &m_faceTable, _1);
|
||||
return {addFace, m_netmon};
|
||||
}
|
||||
|
||||
FaceSystem::FaceSystem(FaceTable& faceTable)
|
||||
: FaceSystem(faceTable, make_shared<ndn::net::NetworkMonitor>(getGlobalIoService()))
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user