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

ircd::server: Re-resolve DNS for peer after TTL expiration.

This commit is contained in:
Jason Volk 2020-11-05 02:13:24 -08:00
parent d6200a7ac3
commit f0f25ff236

View file

@ -183,7 +183,18 @@ ircd::server::get(const net::hostport &hostport)
if(it == peers.end() || it->first != hostcanon)
it = create(hostport, it);
return *it->second;
auto &peer
{
*it->second
};
if(peer.expired() && !peer.op_resolve)
{
assert(peer.hostcanon.data() == it->first.data());
peer.resolve(peer.open_opts.hostport);
}
return peer;
}
decltype(ircd::server::peers)::iterator
@ -206,9 +217,7 @@ ircd::server::create(const net::hostport &hostport,
assert(!empty(peer->hostcanon));
const string_view key{peer->hostcanon};
it = peers.emplace_hint(it, key, std::move(peer));
assert(it->second->hostcanon.data() == it->first.data());
it->second->resolve(it->second->open_opts.hostport);
return it;
}
@ -2104,6 +2113,9 @@ ircd::server::link::open(const net::open_opts &open_opts)
if(op_init)
return false;
if(opened())
return false;
auto handler
{
std::bind(&link::handle_open, this, ph::_1)