Line data Source code
1 : #ifndef THINGER_ASIO_UNIX_SOCKET_SERVER_HPP
2 : #define THINGER_ASIO_UNIX_SOCKET_SERVER_HPP
3 :
4 : #include "socket_server_base.hpp"
5 : #include "sockets/unix_socket.hpp"
6 : #include <boost/asio/local/stream_protocol.hpp>
7 :
8 : namespace thinger::asio {
9 :
10 : class unix_socket_server : public socket_server_base {
11 : public:
12 : // Constructor with io_context providers
13 : unix_socket_server(std::string unix_path,
14 : io_context_provider acceptor_context_provider,
15 : io_context_provider connection_context_provider,
16 : std::set<std::string> allowed_remotes = {},
17 : std::set<std::string> forbidden_remotes = {});
18 :
19 : // Legacy constructor for backward compatibility (uses workers)
20 : unix_socket_server(std::string unix_path,
21 : std::set<std::string> allowed_remotes = {},
22 : std::set<std::string> forbidden_remotes = {});
23 :
24 : ~unix_socket_server();
25 :
26 : // Override stop to properly close acceptor
27 : bool stop() override;
28 :
29 : // Override from base
30 : std::string get_service_name() const override;
31 0 : uint16_t local_port() const override { return 0; }
32 :
33 : protected:
34 : bool create_acceptor() override;
35 : void accept_connection() override;
36 :
37 : private:
38 : std::unique_ptr<boost::asio::local::stream_protocol::acceptor> acceptor_;
39 : std::string unix_path_;
40 : };
41 :
42 : } // namespace thinger::asio
43 :
44 : #endif // THINGER_ASIO_UNIX_SOCKET_SERVER_HPP
|