0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-26 00:32:35 +01:00

ircd::net: Move resolution constructor from ipport to remote.

This commit is contained in:
Jason Volk 2018-01-04 13:53:23 -08:00
parent 8ccdd8568f
commit dd137d50e3
2 changed files with 13 additions and 16 deletions

View file

@ -118,7 +118,6 @@ struct ircd::net::ipport
explicit operator bool() const;
bool operator!() const { return !static_cast<bool>(*this); }
ipport(const hostport &); // DNS lookup! May yield ircd::ctx!
ipport(const uint32_t &ip, const uint16_t &port);
ipport(const uint128_t &ip, const uint16_t &port);
ipport(const boost::asio::ip::address &, const uint16_t &port);
@ -145,11 +144,7 @@ struct ircd::net::remote
:ipport{ipp}
{}
remote(const hostport &hp)
:ipport{hp}
,hostname{std::string{hp.host}}
{}
remote(const hostport &hp);
remote() = default;
friend std::ostream &operator<<(std::ostream &, const remote &);

View file

@ -1676,6 +1676,18 @@ ircd::net::string(const mutable_buffer &buf,
// remote
//
ircd::net::remote::remote(const hostport &hostport)
:ipport
{
resolve(hostport)
}
,hostname
{
hostport.host
}
{
}
std::ostream &
ircd::net::operator<<(std::ostream &s, const remote &t)
{
@ -1721,16 +1733,6 @@ ircd::net::make_endpoint(const ipport &ipport)
};
}
ircd::net::ipport::ipport(const hostport &hp)
{
ctx::future<ipport> future
{
resolve(hp)
};
*this = future.get();
}
ircd::net::ipport::ipport(const boost::asio::ip::address &address,
const uint16_t &port)
{