mirror of
https://github.com/matrix-construct/construct
synced 2024-11-25 16:22:35 +01:00
ircd::server: Use fixed tls vector for copying link pointers.
This commit is contained in:
parent
9a3bda06af
commit
51d0f1a6a4
2 changed files with 9 additions and 6 deletions
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue