mgmt: remove listen option from unix channel configuration

refs: #2188

Change-Id: I11adf075b03eab3d22f8160e5d619e3ed445dd29
This commit is contained in:
Steve DiBenedetto committed 2014-11-17 12:24:44 -07:00
1 parent 70db992dd1
commit dbcb1a1192
3 files changed
+10 -35

No files matched your search

+6 -15
View File
@@ -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<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 @@ FaceManager::processSectionUnix(const ConfigSection& configSection, bool isDryRu
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
+4 -3
View File
@@ -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.
-17
View File
@@ -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 =