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

Method createServer

programs/keeper/Keeper.cpp:208–236  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

206}
207
208void Keeper::createServer(const std::string & listen_host, const char * port_name, bool listen_try, CreateServerFunc && func) const
209{
210 /// For testing purposes, user may omit tcp_port or http_port or https_port in configuration file.
211 if (!config().has(port_name))
212 return;
213
214 auto port = config().getInt(port_name);
215 try
216 {
217 func(port);
218 }
219 catch (const Poco::Exception &)
220 {
221 std::string message = "Listen [" + listen_host + "]:" + std::to_string(port) + " failed: " + getCurrentExceptionMessage(false);
222
223 if (listen_try)
224 {
225 LOG_WARNING(&logger(), "{}. If it is an IPv6 or IPv4 address and your host has disabled IPv6 or IPv4, then consider to "
226 "specify not disabled IPv4 or IPv6 address to listen in <listen_host> element of configuration "
227 "file. Example for disabled IPv6: <listen_host>0.0.0.0</listen_host> ."
228 " Example for disabled IPv4: <listen_host>::</listen_host>",
229 message);
230 }
231 else
232 {
233 throw Exception{message, ErrorCodes::NETWORK_ERROR};
234 }
235 }
236}
237
238void Keeper::uninitialize()
239{

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected