MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / MySQLHandlerFactory

Method MySQLHandlerFactory

src/Server/MySQLHandlerFactory.cpp:19–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17{
18
19MySQLHandlerFactory::MySQLHandlerFactory(IServer & server_, bool secure_required_, const ProfileEvents::Event & read_event_, const ProfileEvents::Event & write_event_)
20 : server(server_)
21 , log(getLogger("MySQLHandlerFactory"))
22#if USE_SSL
23 , keypair(KeyPair::generateRSA())
24#endif
25 , secure_required(secure_required_)
26 , read_event(read_event_)
27 , write_event(write_event_)
28{
29#if USE_SSL
30 try
31 {
32 Poco::Net::SSLManager::instance().defaultServerContext();
33 }
34 catch (...)
35 {
36 LOG_TRACE(log, "Failed to create SSL context. SSL will be disabled. Error: {}", getCurrentExceptionMessage(false));
37 ssl_enabled = false;
38 }
39
40 /// Reading RSA keys for SHA256 authentication plugin.
41 try
42 {
43 const Poco::Util::LayeredConfiguration & config = Poco::Util::Application::instance().config();
44
45 String private_key_file_property = "openSSL.server.privateKeyFile";
46 String private_key_file = config.getString(private_key_file_property);
47
48 keypair = KeyPair::fromFile(private_key_file);
49 }
50 catch (...)
51 {
52 LOG_TRACE(log, "Failed to read RSA key pair from server certificate. Error: {}", getCurrentExceptionMessage(false));
53 LOG_TRACE(log, "Generating new RSA key pair.");
54
55 keypair = KeyPair::generateRSA();
56 }
57#endif
58}
59
60Poco::Net::TCPServerConnection * MySQLHandlerFactory::createConnectionImpl(const Poco::Net::StreamSocket & socket, TCPServer & tcp_server)
61{

Callers

nothing calls this directly

Calls 5

defaultServerContextMethod · 0.80
getLoggerFunction · 0.50
configMethod · 0.45
getStringMethod · 0.45

Tested by

no test coverage detected