mgmt: remove listen option from unix channel configuration
refs: #2188
Change-Id: I11adf075b03eab3d22f8160e5d619e3ed445dd29
diff --git a/daemon/mgmt/face-manager.cpp b/daemon/mgmt/face-manager.cpp
index e4286e8..daba08e 100644
--- a/daemon/mgmt/face-manager.cpp
+++ b/daemon/mgmt/face-manager.cpp
@@ -222,16 +222,14 @@
void
FaceManager::processSectionUnix(const ConfigSection& configSection, bool isDryRun)
{
- // ; the unix section contains settings of UNIX stream faces and channels
+ // ; the unix section contains settings of Unix stream faces and channels
// unix
// {
- // listen yes ; set to 'no' to disable UNIX stream listener, default 'yes'
- // path /var/run/nfd.sock ; UNIX stream listener path
+ // path /var/run/nfd.sock ; Unix stream listener path
// }
#if defined(HAVE_UNIX_SOCKETS)
- bool needToListen = true;
std::string path = "/var/run/nfd.sock";
for (ConfigSection::const_iterator i = configSection.begin();
@@ -242,10 +240,6 @@
{
path = i->second.get_value<std::string>();
}
- else if (i->first == "listen")
- {
- needToListen = parseYesNo(i, i->first, "unix");
- }
else
{
throw ConfigFile::Error("Unrecognized option \"" + i->first + "\" in \"unix\" section");
@@ -270,17 +264,14 @@
shared_ptr<UnixStreamFactory> factory = make_shared<UnixStreamFactory>();
shared_ptr<UnixStreamChannel> unixChannel = factory->createChannel(path);
- if (needToListen)
- {
- // Should acceptFailed callback be used somehow?
- unixChannel->listen(bind(&FaceTable::add, &m_faceTable, _1),
- UnixStreamChannel::ConnectFailedCallback());
- }
+ // Should acceptFailed callback be used somehow?
+ unixChannel->listen(bind(&FaceTable::add, &m_faceTable, _1),
+ UnixStreamChannel::ConnectFailedCallback());
m_factories.insert(std::make_pair("unix", factory));
}
#else
- throw ConfigFile::Error("NFD was compiled without UNIX sockets support, "
+ throw ConfigFile::Error("NFD was compiled without Unix sockets support, "
"cannot process \"unix\" section");
#endif // HAVE_UNIX_SOCKETS
diff --git a/nfd.conf.sample.in b/nfd.conf.sample.in
index 210ecba..eb0de12 100644
--- a/nfd.conf.sample.in
+++ b/nfd.conf.sample.in
@@ -64,11 +64,12 @@
; The face_system section defines what faces and channels are created.
face_system
{
- ; The unix section contains settings of UNIX stream faces and channels.
+ ; The unix section contains settings of Unix stream faces and channels.
+ ; Unix channel is always listening; delete unix section to disable
+ ; Unix stream faces and channels.
unix
{
- listen yes ; set to 'no' to disable UNIX stream listener, default 'yes'
- path /var/run/nfd.sock ; UNIX stream listener path
+ path /var/run/nfd.sock ; Unix stream listener path
}
; The tcp section contains settings of TCP faces and channels.
diff --git a/tests/daemon/mgmt/face-manager.cpp b/tests/daemon/mgmt/face-manager.cpp
index 70d8d83..966844a 100644
--- a/tests/daemon/mgmt/face-manager.cpp
+++ b/tests/daemon/mgmt/face-manager.cpp
@@ -342,7 +342,6 @@
"{\n"
" unix\n"
" {\n"
- " listen yes\n"
" path /tmp/nfd.sock\n"
" }\n"
"}\n";
@@ -357,7 +356,6 @@
"{\n"
" unix\n"
" {\n"
- " listen yes\n"
" path /var/run/nfd.sock\n"
" }\n"
"}\n";
@@ -365,21 +363,6 @@
BOOST_CHECK_NO_THROW(parseConfig(CONFIG, true));
}
-BOOST_AUTO_TEST_CASE(TestProcessSectionUnixBadListen)
-{
- const std::string CONFIG =
- "face_system\n"
- "{\n"
- " unix\n"
- " {\n"
- " listen hello\n"
- " }\n"
- "}\n";
- BOOST_CHECK_EXCEPTION(parseConfig(CONFIG, false), ConfigFile::Error,
- bind(&isExpectedException, _1,
- "Invalid value for option \"listen\" in \"unix\" section"));
-}
-
BOOST_AUTO_TEST_CASE(TestProcessSectionUnixUnknownOption)
{
const std::string CONFIG =