Line data Source code
1 : #ifndef THINGER_HTTP_POOL_SERVER_HPP
2 : #define THINGER_HTTP_POOL_SERVER_HPP
3 :
4 : #include "http_server_base.hpp"
5 : #include "../../asio/worker_client.hpp"
6 : #include "../../asio/workers.hpp"
7 :
8 : namespace thinger::http {
9 :
10 : /**
11 : * HTTP server integrated with the worker thread pool.
12 : * Designed for high-performance server applications where
13 : * the server runs alongside other asynchronous services.
14 : * Uses the global worker thread pool for optimal resource sharing.
15 : */
16 : class pool_server : public http_server_base, public asio::worker_client {
17 : protected:
18 : // Create socket server that uses worker pool
19 : std::unique_ptr<asio::socket_server> create_socket_server(
20 : const std::string& host, const std::string& port) override;
21 :
22 : // Create Unix socket server that uses worker pool
23 : std::unique_ptr<asio::unix_socket_server> create_unix_socket_server(
24 : const std::string& unix_path) override;
25 :
26 : public:
27 : pool_server();
28 : ~pool_server() override;
29 :
30 : // Expose http_server_base::start overloads (hidden by worker_client::start)
31 : using http_server_base::start;
32 :
33 : // Implementation of worker_client interface
34 0 : bool start() override { return true; } // Already started in listen()
35 : bool stop() override;
36 : void wait() override;
37 : };
38 :
39 : } // namespace thinger::http
40 :
41 : #endif // THINGER_HTTP_POOL_SERVER_HPP
|