From 26ed7c277029fdd343829d903f60466be9357771 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Sat, 1 Sep 2018 22:31:58 -0700 Subject: [PATCH] ircd::client: Move client make_shared into ircd/client.cc due to SO issues. --- include/ircd/client.h | 2 +- ircd/client.cc | 11 +++++++++++ modules/s_listen.cc | 15 ++------------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/include/ircd/client.h b/include/ircd/client.h index 1e8046485..1555268d2 100644 --- a/include/ircd/client.h +++ b/include/ircd/client.h @@ -35,6 +35,7 @@ struct ircd::client static ctx::pool pool; static uint64_t ctr; // monotonic + static void create(const std::shared_ptr &); static size_t count(net::ipport remote); static void interrupt_all(); static void close_all(); @@ -62,7 +63,6 @@ struct ircd::client bool main(); bool async(); - public: client(std::shared_ptr); client(client &&) = delete; client(const client &) = delete; diff --git a/ircd/client.cc b/ircd/client.cc index 9cff2dd45..a6a2eea2a 100644 --- a/ircd/client.cc +++ b/ircd/client.cc @@ -242,6 +242,17 @@ ircd::client::wait_all() pool.join(); } +void +ircd::client::create(const std::shared_ptr &sock) +{ + const auto client + { + std::make_shared(sock) + }; + + client->async(); +} + size_t ircd::client::count(net::ipport remote) { diff --git a/modules/s_listen.cc b/modules/s_listen.cc index 95597b773..3a58eda3e 100644 --- a/modules/s_listen.cc +++ b/modules/s_listen.cc @@ -157,18 +157,7 @@ load_listener(const m::event &event) return load_listener(name, opts); } -void -_listener_action(const std::shared_ptr &sock) -{ - const auto client - { - std::make_shared(sock) - }; - - client->async(); -} - -bool +static bool _listener_proffer(const net::ipport &ipport) { if(unlikely(ircd::runlevel != ircd::runlevel::RUN)) @@ -221,7 +210,7 @@ try "A listener with the name '%s' is already loaded", name }; - listeners.emplace_back(name, opts, _listener_action, _listener_proffer); + listeners.emplace_back(name, opts, client::create, _listener_proffer); return true; } catch(const std::exception &e)