0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-06-01 01:28:54 +02:00

ircd::client: Move client make_shared into ircd/client.cc due to SO issues.

This commit is contained in:
Jason Volk 2018-09-01 22:31:58 -07:00
parent 03c353599c
commit 26ed7c2770
3 changed files with 14 additions and 14 deletions

View file

@ -35,6 +35,7 @@ struct ircd::client
static ctx::pool pool;
static uint64_t ctr; // monotonic
static void create(const std::shared_ptr<socket> &);
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<socket>);
client(client &&) = delete;
client(const client &) = delete;

View file

@ -242,6 +242,17 @@ ircd::client::wait_all()
pool.join();
}
void
ircd::client::create(const std::shared_ptr<socket> &sock)
{
const auto client
{
std::make_shared<ircd::client>(sock)
};
client->async();
}
size_t
ircd::client::count(net::ipport remote)
{

View file

@ -157,18 +157,7 @@ load_listener(const m::event &event)
return load_listener(name, opts);
}
void
_listener_action(const std::shared_ptr<socket> &sock)
{
const auto client
{
std::make_shared<ircd::client>(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)