diff --git a/daemon/mgmt/face-manager.cpp b/daemon/mgmt/face-manager.cpp index e4286e85..daba08e3 100644 --- a/daemon/mgmt/face-manager.cpp +++ b/daemon/mgmt/face-manager.cpp @@ -222,16 +222,14 @@ FaceManager::onConfig(const ConfigSection& configSection, 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 @@ FaceManager::processSectionUnix(const ConfigSection& configSection, bool isDryRu { path = i->second.get_value(); } - 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 @@ FaceManager::processSectionUnix(const ConfigSection& configSection, bool isDryRu shared_ptr factory = make_shared(); shared_ptr 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 210ecbae..eb0de120 100644 --- a/nfd.conf.sample.in +++ b/nfd.conf.sample.in @@ -64,11 +64,12 @@ tables ; 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 70d8d83b..966844ae 100644 --- a/tests/daemon/mgmt/face-manager.cpp +++ b/tests/daemon/mgmt/face-manager.cpp @@ -342,7 +342,6 @@ BOOST_AUTO_TEST_CASE(TestProcessSectionUnix) "{\n" " unix\n" " {\n" - " listen yes\n" " path /tmp/nfd.sock\n" " }\n" "}\n"; @@ -357,7 +356,6 @@ BOOST_AUTO_TEST_CASE(TestProcessSectionUnixDryRun) "{\n" " unix\n" " {\n" - " listen yes\n" " path /var/run/nfd.sock\n" " }\n" "}\n"; @@ -365,21 +363,6 @@ BOOST_AUTO_TEST_CASE(TestProcessSectionUnixDryRun) 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 =