0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-26 15:33:54 +01:00

ircd::server: Copies of the link pointers must be on stack.

This commit is contained in:
Jason Volk 2018-05-08 15:50:48 -07:00
parent c47324f741
commit 6b0c011535
2 changed files with 10 additions and 11 deletions

View file

@ -22,7 +22,7 @@ struct ircd::server::peer
{
struct err;
static constexpr const size_t &LINK_MAX{32};
static constexpr const size_t &LINK_MAX{16};
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,11 +370,10 @@ void
ircd::server::peer::close(const net::close_opts &opts)
{
op_fini = true;
assert(!ctx::current);
thread_local link *links[LINK_MAX];
pointers(this->links, links);
for(size_t i(0); i < this->links.size(); ++i)
links[i]->close(opts);
link *links[LINK_MAX];
const auto end(pointers(this->links, links));
for(link **link(links); link != end; ++link)
(*link)->close(opts);
if(finished())
return handle_finished();
@ -867,6 +866,7 @@ ircd::server::peer::handle_resolve(std::exception_ptr eptr,
const ipport &ipport)
try
{
const ctx::critical_assertion ca;
assert(op_resolve);
op_resolve = false;
@ -891,11 +891,10 @@ try
if(op_fini)
return;
assert(!ctx::current);
thread_local link *links[LINK_MAX];
pointers(this->links, links);
for(size_t i(0); i < this->links.size(); ++i)
links[i]->open(open_opts);
link *links[LINK_MAX];
const auto end(pointers(this->links, links));
for(link **link(links); link != end; ++link)
(*link)->open(open_opts);
}
catch(const std::exception &e)
{