mgmt: eliminate FaceManager::setConfigFile()
Change-Id: Ib39b05a969345448b3719047093577df31d2bf8a
Refs: #3904
diff --git a/daemon/mgmt/face-manager.cpp b/daemon/mgmt/face-manager.cpp
index 2be2e0b..ba7cb36 100644
--- a/daemon/mgmt/face-manager.cpp
+++ b/daemon/mgmt/face-manager.cpp
@@ -38,7 +38,8 @@
NFD_LOG_INIT("FaceManager");
FaceManager::FaceManager(FaceSystem& faceSystem,
- Dispatcher& dispatcher, CommandAuthenticator& authenticator)
+ Dispatcher& dispatcher,
+ CommandAuthenticator& authenticator)
: NfdManagerBase(dispatcher, authenticator, "faces")
, m_faceSystem(faceSystem)
, m_faceTable(faceSystem.getFaceTable())
@@ -70,12 +71,6 @@
}
void
-FaceManager::setConfigFile(ConfigFile& configFile)
-{
- m_faceSystem.setConfigFile(configFile);
-}
-
-void
FaceManager::createFace(const Name& topPrefix, const Interest& interest,
const ControlParameters& parameters,
const ndn::mgmt::CommandContinuation& done)
diff --git a/daemon/mgmt/face-manager.hpp b/daemon/mgmt/face-manager.hpp
index e50b858..6f05b0f 100644
--- a/daemon/mgmt/face-manager.hpp
+++ b/daemon/mgmt/face-manager.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2017, Regents of the University of California,
+ * Copyright (c) 2014-2018, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -28,6 +28,7 @@
#include "nfd-manager-base.hpp"
#include "face/face-system.hpp"
+
#include <ndn-cxx/mgmt/nfd/face-status.hpp>
#include <ndn-cxx/mgmt/nfd/face-query-filter.hpp>
#include <ndn-cxx/mgmt/nfd/face-event-notification.hpp>
@@ -42,13 +43,8 @@
{
public:
FaceManager(FaceSystem& faceSystem,
- Dispatcher& dispatcher, CommandAuthenticator& authenticator);
-
- /**
- * @brief Subscribe to face_system section for the config file
- */
- void
- setConfigFile(ConfigFile& configFile);
+ Dispatcher& dispatcher,
+ CommandAuthenticator& authenticator);
PUBLIC_WITH_TESTS_ELSE_PRIVATE: // ControlCommand
void
diff --git a/daemon/nfd.cpp b/daemon/nfd.cpp
index e3bcb75..6d5a6c4 100644
--- a/daemon/nfd.cpp
+++ b/daemon/nfd.cpp
@@ -75,7 +75,7 @@
{
initializeLogging();
- m_forwarder.reset(new Forwarder());
+ m_forwarder = make_unique<Forwarder>();
FaceTable& faceTable = m_forwarder->getFaceTable();
faceTable.addReserved(face::makeNullFace(), face::FACEID_NULL);
@@ -134,17 +134,17 @@
std::tie(m_internalFace, m_internalClientFace) = face::makeInternalFace(m_keyChain);
m_forwarder->getFaceTable().addReserved(m_internalFace, face::FACEID_INTERNAL_FACE);
- m_dispatcher.reset(new ndn::mgmt::Dispatcher(*m_internalClientFace, m_keyChain));
+ m_dispatcher = make_unique<ndn::mgmt::Dispatcher>(*m_internalClientFace, m_keyChain);
m_authenticator = CommandAuthenticator::create();
- m_forwarderStatusManager.reset(new ForwarderStatusManager(*m_forwarder, *m_dispatcher));
- m_faceManager.reset(new FaceManager(*m_faceSystem, *m_dispatcher, *m_authenticator));
- m_fibManager.reset(new FibManager(m_forwarder->getFib(), m_forwarder->getFaceTable(),
- *m_dispatcher, *m_authenticator));
- m_csManager.reset(new CsManager(m_forwarder->getCs(), m_forwarder->getCounters(),
- *m_dispatcher, *m_authenticator));
- m_strategyChoiceManager.reset(new StrategyChoiceManager(m_forwarder->getStrategyChoice(),
- *m_dispatcher, *m_authenticator));
+ m_forwarderStatusManager = make_unique<ForwarderStatusManager>(*m_forwarder, *m_dispatcher);
+ m_faceManager = make_unique<FaceManager>(*m_faceSystem, *m_dispatcher, *m_authenticator);
+ m_fibManager = make_unique<FibManager>(m_forwarder->getFib(), m_forwarder->getFaceTable(),
+ *m_dispatcher, *m_authenticator);
+ m_csManager = make_unique<CsManager>(m_forwarder->getCs(), m_forwarder->getCounters(),
+ *m_dispatcher, *m_authenticator);
+ m_strategyChoiceManager = make_unique<StrategyChoiceManager>(m_forwarder->getStrategyChoice(),
+ *m_dispatcher, *m_authenticator);
ConfigFile config(&ignoreRibAndLogSections);
general::setConfigFile(config);
@@ -153,7 +153,7 @@
tablesConfig.setConfigFile(config);
m_authenticator->setConfigFile(config);
- m_faceManager->setConfigFile(config);
+ m_faceSystem->setConfigFile(config);
// parse config file
if (!m_configFile.empty()) {
@@ -178,7 +178,6 @@
{
// Logging
initializeLogging();
- /// \todo Reopen log file
// Other stuff
ConfigFile config(&ignoreRibAndLogSections);
@@ -189,7 +188,7 @@
tablesConfig.setConfigFile(config);
m_authenticator->setConfigFile(config);
- m_faceManager->setConfigFile(config);
+ m_faceSystem->setConfigFile(config);
if (!m_configFile.empty()) {
config.parse(m_configFile, false);
@@ -204,7 +203,7 @@
{
// reload only face_system section of the config file to re-initialize multicast faces
ConfigFile config(&ConfigFile::ignoreUnknownSection);
- m_faceManager->setConfigFile(config);
+ m_faceSystem->setConfigFile(config);
if (!m_configFile.empty()) {
config.parse(m_configFile, false);
diff --git a/tests/daemon/mgmt/face-manager-command-fixture.cpp b/tests/daemon/mgmt/face-manager-command-fixture.cpp
index 4053682..8fcb965 100644
--- a/tests/daemon/mgmt/face-manager-command-fixture.cpp
+++ b/tests/daemon/mgmt/face-manager-command-fixture.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2017, Regents of the University of California,
+ * Copyright (c) 2014-2018, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -39,7 +39,7 @@
{
dispatcher.addTopPrefix("/localhost/nfd");
- std::string config =
+ const std::string config =
"face_system\n"
"{\n"
" tcp\n"
@@ -70,7 +70,7 @@
"\n";
ConfigFile cf;
- manager.setConfigFile(cf);
+ faceSystem.setConfigFile(cf);
authenticator->setConfigFile(cf);
cf.parse(config, false, "dummy-config");
}
@@ -109,12 +109,12 @@
: node1(m_keyChain, 16363)
, node2(m_keyChain, 26363)
{
- advanceClocks(time::milliseconds(1), 5);
+ advanceClocks(1_ms, 5);
}
FaceManagerCommandFixture::~FaceManagerCommandFixture()
{
- advanceClocks(time::milliseconds(1), 5);
+ advanceClocks(1_ms, 5);
}
} // namespace tests