mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 09:32:06 +00:00
some refactoring
This commit is contained in:
parent
d001baec87
commit
c3ac0c434b
@ -1903,7 +1903,7 @@ void Server::createServers(
|
||||
new HTTPServerConnectionFactory(context(), http_params, createHandlerFactory(*this, async_metrics, "InterserverIOHTTPHandler-factory"))
|
||||
);
|
||||
|
||||
throw Exception("LOGICAL ERROR: Unknown protocol name.", ErrorCodes::LOGICAL_ERROR);
|
||||
throw Exception(ErrorCodes::INVALID_CONFIG_PARAMETER, "Protocol configuration error, unknown protocol name '{}'", type);
|
||||
};
|
||||
|
||||
for (const auto & protocol : protocols)
|
||||
@ -1927,40 +1927,27 @@ void Server::createServers(
|
||||
if (type == "tls")
|
||||
{
|
||||
if (is_secure)
|
||||
{
|
||||
// misconfigured - only one tls layer is allowed
|
||||
stack.reset();
|
||||
break;
|
||||
}
|
||||
throw Exception(ErrorCodes::INVALID_CONFIG_PARAMETER, "Protocol '{}' contains more than one TLS layer", protocol);
|
||||
is_secure = true;
|
||||
}
|
||||
|
||||
TCPServerConnectionFactory::Ptr factory = createFactory(type, conf_name);
|
||||
if (!factory)
|
||||
{
|
||||
// misconfigured - protocol type doesn't exist
|
||||
stack.reset();
|
||||
break;
|
||||
stack->append(createFactory(type, conf_name));
|
||||
}
|
||||
|
||||
stack->append(factory);
|
||||
|
||||
if (!config.has(prefix + "impl"))
|
||||
break;
|
||||
}
|
||||
|
||||
conf_name = "protocols." + config.getString(prefix + "impl");
|
||||
prefix = conf_name + ".";
|
||||
|
||||
if (!pset.insert(prefix).second)
|
||||
if (!pset.insert(conf_name).second)
|
||||
{
|
||||
// misconfigured - loop is detected
|
||||
stack.reset();
|
||||
break;
|
||||
throw Exception(ErrorCodes::INVALID_CONFIG_PARAMETER, "Protocol '{}' configuration contains a loop on '{}'", protocol, conf_name);
|
||||
}
|
||||
}
|
||||
|
||||
if (!stack)
|
||||
if (!stack || stack->size() == 0)
|
||||
continue;
|
||||
|
||||
createServer(config, listen_host, port_name.c_str(), listen_try, start_servers, servers, [&](UInt16 port) -> ProtocolServerAdapter
|
||||
|
@ -111,6 +111,8 @@ public:
|
||||
{
|
||||
stack.push_back(factory);
|
||||
}
|
||||
|
||||
size_t size() { return stack.size(); }
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user