0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-07-02 16:58:19 +02:00

ircd::server: Use fixed tls vector for copying link pointers.

This commit is contained in:
Jason Volk 2018-05-07 23:22:15 -07:00
parent 9a3bda06af
commit 51d0f1a6a4
2 changed files with 9 additions and 6 deletions

View file

@ -22,6 +22,7 @@ struct ircd::server::peer
{
struct err;
static constexpr const size_t &LINK_MAX{32};
static conf::item<size_t> link_min_default;
static conf::item<size_t> link_max_default;
static conf::item<seconds> error_clear_default;

View file

@ -370,10 +370,11 @@ void
ircd::server::peer::close(const net::close_opts &opts)
{
op_fini = true;
std::vector<link *> links(this->links.size());
assert(!ctx::current);
thread_local link *links[LINK_MAX];
pointers(this->links, links);
for(const auto &link : links)
link->close(opts);
for(size_t i(0); i < this->links.size(); ++i)
links[i]->close(opts);
if(finished())
return handle_finished();
@ -890,10 +891,11 @@ try
if(op_fini)
return;
std::vector<link *> links(this->links.size());
assert(!ctx::current);
thread_local link *links[LINK_MAX];
pointers(this->links, links);
for(const auto &link : links)
link->open(open_opts);
for(size_t i(0); i < this->links.size(); ++i)
links[i]->open(open_opts);
}
catch(const std::exception &e)
{