mirror of
https://github.com/matrix-construct/construct
synced 2024-12-26 07:23:53 +01:00
ircd::server: Re-resolve DNS for peer after TTL expiration.
This commit is contained in:
parent
d6200a7ac3
commit
f0f25ff236
1 changed files with 15 additions and 3 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue