MCPcopy Create free account
hub / github.com/ByConity/ByConity / createServer

Method createServer

programs/server/Server.cpp:417–446  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

415}
416
417void Server::createServer(const std::string & listen_host, const char * port_name, bool listen_try, CreateServerFunc && func) const
418{
419 /// For testing purposes, user may omit tcp_port or http_port or https_port in configuration file.
420 if (!config().has(port_name))
421 return;
422
423 auto port = config().getInt(port_name);
424 try
425 {
426 func(port);
427 global_context->registerServerPort(port_name, port);
428 }
429 catch (const Poco::Exception &)
430 {
431 std::string message = "Listen [" + listen_host + "]:" + std::to_string(port) + " failed: " + getCurrentExceptionMessage(false);
432
433 if (listen_try)
434 {
435 LOG_WARNING(&logger(), "{}. If it is an IPv6 or IPv4 address and your host has disabled IPv6 or IPv4, then consider to "
436 "specify not disabled IPv4 or IPv6 address to listen in <listen_host> element of configuration "
437 "file. Example for disabled IPv6: <listen_host>0.0.0.0</listen_host> ."
438 " Example for disabled IPv4: <listen_host>::</listen_host>",
439 message);
440 }
441 else
442 {
443 throw Exception{message, ErrorCodes::NETWORK_ERROR};
444 }
445 }
446}
447
448void Server::uninitialize()
449{

Callers

nothing calls this directly

Calls 7

funcFunction · 0.85
registerServerPortMethod · 0.80
configFunction · 0.50
to_stringFunction · 0.50
hasMethod · 0.45
getIntMethod · 0.45

Tested by

no test coverage detected