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 From 4ab3cd653f3eb19ff82838f777984c9d16e64a80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Tue, 15 Nov 2016 00:49:55 +0100 Subject: Fix some little compilation errors with some configs, from last commit --- src/identd/identd_server.hpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/identd/identd_server.hpp') diff --git a/src/identd/identd_server.hpp b/src/identd/identd_server.hpp index 4270749..5f74976 100644 --- a/src/identd/identd_server.hpp +++ b/src/identd/identd_server.hpp @@ -2,6 +2,7 @@ #include #include +#include #include class BiboumiComponent; -- cgit v1.2.3 From f0bc6c83a8eb548d0a3edbf7c16a6922bfd24ba5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Wed, 8 Mar 2017 19:04:15 +0100 Subject: Pass the shared_ptr by reference, to avoid useless copies --- src/identd/identd_server.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/identd/identd_server.hpp') diff --git a/src/identd/identd_server.hpp b/src/identd/identd_server.hpp index 5f74976..b1c8ec8 100644 --- a/src/identd/identd_server.hpp +++ b/src/identd/identd_server.hpp @@ -10,7 +10,7 @@ class BiboumiComponent; class IdentdServer: public TcpSocketServer { public: - IdentdServer(const BiboumiComponent& biboumi_component, std::shared_ptr poller, const uint16_t port): + IdentdServer(const BiboumiComponent& biboumi_component, std::shared_ptr& poller, const uint16_t port): TcpSocketServer(poller, port), biboumi_component(biboumi_component) {} -- cgit v1.2.3