mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-14 18:32:29 +00:00
97f2a2213e
* Move some code outside dbms/src folder * Fix paths
38 lines
835 B
C++
38 lines
835 B
C++
#pragma once
|
|
|
|
#include <Poco/Net/TCPServerConnectionFactory.h>
|
|
#include <common/logger_useful.h>
|
|
#include "IServer.h"
|
|
#include "TCPHandler.h"
|
|
|
|
namespace Poco { class Logger; }
|
|
|
|
namespace DB
|
|
{
|
|
|
|
class TCPHandlerFactory : public Poco::Net::TCPServerConnectionFactory
|
|
{
|
|
private:
|
|
IServer & server;
|
|
Poco::Logger * log;
|
|
|
|
public:
|
|
explicit TCPHandlerFactory(IServer & server_, bool secure_ = false)
|
|
: server(server_)
|
|
, log(&Logger::get(std::string("TCP") + (secure_ ? "S" : "") + "HandlerFactory"))
|
|
{
|
|
}
|
|
|
|
Poco::Net::TCPServerConnection * createConnection(const Poco::Net::StreamSocket & socket) override
|
|
{
|
|
LOG_TRACE(log,
|
|
"TCP Request. "
|
|
<< "Address: "
|
|
<< socket.peerAddress().toString());
|
|
|
|
return new TCPHandler(server, socket);
|
|
}
|
|
};
|
|
|
|
}
|