0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-16 15:00:51 +01:00

ircd::server: Fix concurrency assumptions in server::get().

This commit is contained in:
Jason Volk 2019-03-22 15:13:55 -07:00
parent dfd9a3ed83
commit 3db83faac3

View file

@ -115,7 +115,7 @@ ircd::server::interrupt_all()
ircd::server::peer &
ircd::server::get(const net::hostport &hostport)
{
thread_local char canonbuf[512];
char canonbuf[256];
const auto canonized
{
net::canonize(canonbuf, hostport)
@ -140,7 +140,6 @@ ircd::server::get(const net::hostport &hostport)
assert(!empty(peer->hostcanon));
const string_view key{peer->hostcanon};
it = peers.emplace_hint(it, key, std::move(peer));
it->second->resolve(it->second->open_opts.hostport);
assert(it->second->hostcanon.data() == it->first.data());
assert(key == canonized);
}
@ -156,6 +155,7 @@ ircd::server::create(const net::hostport &hostport)
std::make_unique<server::peer>(hostport)
};
peer->resolve(peer->open_opts.hostport);
return peer;
}