mirror of
https://github.com/matrix-construct/construct
synced 2024-06-11 14:38:57 +02:00
ircd::server: Add avail() convenience to interface.
This commit is contained in:
parent
0568719030
commit
5ecc9f99d8
|
@ -51,6 +51,7 @@ namespace ircd::server
|
|||
string_view errmsg(const net::hostport &) noexcept;
|
||||
bool errant(const net::hostport &) noexcept;
|
||||
bool exists(const net::hostport &) noexcept;
|
||||
bool avail(const net::hostport &) noexcept; // exists() && !errant()
|
||||
peer &find(const net::hostport &);
|
||||
|
||||
// mutable utils
|
||||
|
|
|
@ -216,6 +216,25 @@ ircd::server::errclear(const net::hostport &hostport)
|
|||
return peer.err_clear();
|
||||
}
|
||||
|
||||
bool
|
||||
ircd::server::avail(const net::hostport &hostport)
|
||||
noexcept
|
||||
{
|
||||
const auto hostcanon
|
||||
{
|
||||
server::canonize(hostport)
|
||||
};
|
||||
|
||||
const auto it
|
||||
{
|
||||
peers.find(hostcanon)
|
||||
};
|
||||
|
||||
return it != end(peers)?
|
||||
!it->second->err_has():
|
||||
false;
|
||||
}
|
||||
|
||||
bool
|
||||
ircd::server::errant(const net::hostport &hostport)
|
||||
noexcept
|
||||
|
|
Loading…
Reference in a new issue