0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-19 00:10:59 +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; 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_min_default;
static conf::item<size_t> link_max_default; static conf::item<size_t> link_max_default;
static conf::item<seconds> error_clear_default; static conf::item<seconds> error_clear_default;

View file

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