#pragma once #include #include #include #include class BiboumiComponent; class IdentdServer: public TcpSocketServer { public: IdentdServer(const BiboumiComponent& biboumi_component, std::shared_ptr& poller, const uint16_t port): TcpSocketServer(poller, port), biboumi_component(biboumi_component) {} const BiboumiComponent& get_biboumi_component() const { return this->biboumi_component; } void shutdown() { if (this->poller->is_managing_socket(this->socket)) this->poller->remove_socket_handler(this->socket); ::close(this->socket); } void clean() { this->sockets.erase(std::remove_if(this->sockets.begin(), this->sockets.end(), [](const std::unique_ptr& socket) { return socket->get_socket() == -1; }), this->sockets.end()); } private: const BiboumiComponent& biboumi_component; };