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

ircd::server: Reorg peer::resolve() as unary using member data.

This commit is contained in:
Jason Volk 2020-11-11 14:24:38 -08:00
parent e2711da664
commit da0464e101
2 changed files with 21 additions and 8 deletions

View file

@ -54,7 +54,7 @@ struct ircd::server::peer
void handle_resolve_AAAA(const hostport &, const json::array &);
void handle_resolve_SRV(const hostport &, const json::array &);
void resolve(const hostport &, const net::dns::opts &);
void resolve(const hostport &);
void resolve();
void cleanup_canceled();
void disperse_uncommitted(link &);

View file

@ -191,7 +191,7 @@ ircd::server::get(const net::hostport &hostport)
if(peer.expired() && !peer.op_resolve)
{
assert(peer.hostcanon.data() == it->first.data());
peer.resolve(peer.open_opts.hostport);
peer.resolve();
}
return peer;
@ -1346,12 +1346,25 @@ ircd::server::peer::del(link &link)
}
void
ircd::server::peer::resolve(const hostport &hostport)
ircd::server::peer::resolve()
{
net::dns::opts opts;
const net::hostport canon
{
this->hostcanon
};
// Figure out the initial query type. Most of the time it's SRV.
opts.qtype = net::service(hostport) && !net::port(hostport)?
auto &hostport
{
this->open_opts.hostport
};
hostport.host = host(canon);
hostport.service = service(canon);
hostport.port = port(hostport);
net::dns::opts opts;
opts.qtype =
net::service(hostport) && !net::port(hostport)?
33: // SRV
peer::enable_ipv6 && net::enable_ipv6?
28: // AAAA
@ -1368,7 +1381,7 @@ ircd::server::peer::resolve(const hostport &hostport)
}
void
ircd::server::peer::resolve(const hostport &hostport,
ircd::server::peer::resolve(const net::hostport &hostport,
const net::dns::opts &opts)
try
{