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
@@ -38,8 +38,7 @@ ProtocolFactory::getRegistry()
|
||||
}
|
||||
|
||||
unique_ptr<ProtocolFactory>
|
||||
ProtocolFactory::create(const std::string& id, shared_ptr<ndn::net::NetworkMonitor> netmon,
|
||||
const FaceCreatedCallback& addFace)
|
||||
ProtocolFactory::create(const std::string& id, const CtorParams& params)
|
||||
{
|
||||
Registry& registry = getRegistry();
|
||||
auto found = registry.find(id);
|
||||
@@ -47,10 +46,7 @@ ProtocolFactory::create(const std::string& id, shared_ptr<ndn::net::NetworkMonit
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto factory = found->second();
|
||||
factory->netmon = std::move(netmon);
|
||||
factory->addFace = addFace;
|
||||
return factory;
|
||||
return found->second(params);
|
||||
}
|
||||
|
||||
std::set<std::string>
|
||||
@@ -62,5 +58,13 @@ ProtocolFactory::listRegistered()
|
||||
return factoryIds;
|
||||
}
|
||||
|
||||
ProtocolFactory::ProtocolFactory(const CtorParams& params)
|
||||
: addFace(params.addFace)
|
||||
, netmon(params.netmon)
|
||||
{
|
||||
BOOST_ASSERT(addFace != nullptr);
|
||||
BOOST_ASSERT(netmon != nullptr);
|
||||
}
|
||||
|
||||
} // namespace face
|
||||
} // namespace nfd
|
||||
Reference in new issue
Block a user