Added a function for generic address parsing

Changed listen_add_config_param() to use generic address parsing
This commit is contained in:
1848
2018-08-07 19:14:14 +02:00
parent 2127a482da
commit 52521d02ea
4 changed files with 83 additions and 7 deletions

View File

@@ -23,6 +23,7 @@
#include "config/Param.hxx"
#include "config/Data.hxx"
#include "config/Option.hxx"
#include "config/Net.hxx"
#include "system/Error.hxx"
#include "util/RuntimeError.hxx"
#include "fs/AllocatedPath.hxx"
@@ -48,13 +49,7 @@ listen_add_config_param(ClientListener &listener,
{
assert(param != nullptr);
if (0 == strcmp(param->value.c_str(), "any")) {
listener.AddPort(port);
} else if (param->value[0] == '/' || param->value[0] == '~') {
listener.AddPath(param->GetPath());
} else {
listener.AddHost(param->value.c_str(), port);
}
ServerSocketAddGeneric(listener, param->value.c_str(), port);
}
#ifdef ENABLE_SYSTEMD_DAEMON