19 #ifndef _SERVER_SERVER_HPP
20 #define _SERVER_SERVER_HPP
22 #include <sys/types.h>
33 #include <boost/asio.hpp>
34 #include <boost/noncopyable.hpp>
35 #include <boost/shared_ptr.hpp>
36 #include <boost/bind.hpp>
37 #include <boost/filesystem.hpp>
39 namespace bfs = boost::filesystem;
52 class Server :
private boost::noncopyable
56 explicit Server(std::size_t io_service_pool_size,
57 const std::string& application_id,
58 const std::string& application_instance,
59 bool runAsDaemon =
true,
60 const std::string& config_root_path =
"",
61 const std::string& address =
"get_from_config",
62 const std::string& port =
"get_from_config");
76 void handle_accept(
const boost::system::error_code& e);
78 void handle_log_reopen();
79 void initialize_standard_handlers();
80 bool checkLockFile (
const std::string &appid,
const std::string& instance);
81 bool createLockFile(
const std::string &appid,
const std::string& instance);
82 void removeLockFile();
83 void signalRegistrations();
84 void initializeLogging(
bool log2console);
85 void becomeDaemonProcess();
88 boost::asio::signal_set stop_signals_;
89 boost::asio::signal_set log_reopen_signals_;
90 boost::asio::ip::tcp::acceptor acceptor_;
93 bfs::path lockFilePath;
Definition: request_router.hpp:43
Definition: io_service_pool.hpp:32
Definition: server.hpp:52
boost::shared_ptr< Connection > ConnectionPtr
Definition: connection.hpp:65
void run()
Definition: server.cpp:88
void stop()
Definition: server.cpp:104
boost::shared_ptr< RequestHandler > RequestHandlerPtr
Definition: request_handler.hpp:54
~Server()
Definition: server.hpp:64
Server(std::size_t io_service_pool_size, const std::string &application_id, const std::string &application_instance, bool runAsDaemon=true, const std::string &config_root_path="", const std::string &address="get_from_config", const std::string &port="get_from_config")
Definition: server.cpp:24
void register_handler(RequestHandlerPtr _handler)
Definition: server.cpp:119