![]() |
dfx 0.1.0
Linux-based dynamic dataflow executor
|
Asynchronous Unix domain socket control server driven by a FdWatch::Poller. More...
#include <dfx-server/UnixServer.hpp>
Classes | |
| struct | Options |
| Server configuration values (mostly controlled via Utils::SystemConfig). More... | |
Public Member Functions | |
| UnixServer (Utils::SystemConfig &sysConfig, FdWatch::Poller &poller, UnixRouter &router, std::string const &defaultSocketPath="/var/run/dfx.sock") | |
| Construct a Unix control server and register SystemConfig entries. | |
| DISABLE_COPY_AND_MOVE (UnixServer) | |
| UnixServer are not copyable and not movable. | |
| ~UnixServer () | |
| Stop listening and release resources. | |
| void | listen () |
| Start listening on the configured unix socket path. | |
| void | stop () noexcept |
| Stop listening and remove the socket file from the filesystem. | |
| bool | isListening () const noexcept |
| Whether the server socket is currently registered and listening. | |
| void | terminateSession (UnixSessionPtr session) |
| Terminate and forget a session. | |
Asynchronous Unix domain socket control server driven by a FdWatch::Poller.
UnixServer implements the local control-plane server used by dfx components. It listens on an AF_UNIX socket using SOCK_SEQPACKET (message oriented) and accepts client connections in non-blocking mode.
Each accepted client is represented by a UnixSession instance. Incoming requests are routed through a UnixRouter.
On stop():
| dfx::Server::UnixServer::UnixServer | ( | Utils::SystemConfig & | sysConfig, |
| FdWatch::Poller & | poller, | ||
| UnixRouter & | router, | ||
| std::string const & | defaultSocketPath = "/var/run/dfx.sock" ) |
Construct a Unix control server and register SystemConfig entries.
The constructor registers configuration entries (permissions, socket path, backlog, session timeouts, error limits, enabled flag). Once initialization is complete, the server may start automatically depending on the configured "enabled" value (true by default).
| sysConfig | System configuration registry used to expose and update server settings. |
| poller | Poller driving socket accept and session I/O. |
| router | Router used to dispatch decoded requests. |
| defaultSocketPath | Default socket path if not overridden by configuration. |
| dfx::Server::UnixServer::~UnixServer | ( | ) |
Stop listening and release resources.
| dfx::Server::UnixServer::DISABLE_COPY_AND_MOVE | ( | UnixServer | ) |
UnixServer are not copyable and not movable.
|
inlinenoexcept |
Whether the server socket is currently registered and listening.
| void dfx::Server::UnixServer::listen | ( | ) |
Start listening on the configured unix socket path.
Creates/binds/listens on the socket and registers it to the poller for read events. Any existing socket file at the same path is removed first.
|
noexcept |
Stop listening and remove the socket file from the filesystem.
This function is safe to call multiple times.
| void dfx::Server::UnixServer::terminateSession | ( | UnixSessionPtr | session | ) |
Terminate and forget a session.
Removes the session from the internal registry. If it was the last active session, the periodic timer is stopped.
| session | Session to terminate. |