From d872c2b49214c0a4db40a9e2d860802d9eedc563 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Tue, 15 Nov 2016 00:23:19 +0100 Subject: Support the ident protocol fix #3211 --- src/identd/identd_server.hpp | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 src/identd/identd_server.hpp (limited to 'src/identd/identd_server.hpp') diff --git a/src/identd/identd_server.hpp b/src/identd/identd_server.hpp new file mode 100644 index 0000000..4270749 --- /dev/null +++ b/src/identd/identd_server.hpp @@ -0,0 +1,38 @@ +#pragma once + +#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; +}; -- cgit v1.2.3