0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-09-27 11:18:51 +02:00

ircd::server: Additional convenience query for linked peers.

This commit is contained in:
Jason Volk 2020-04-25 19:30:21 -07:00
parent 215e79b870
commit 4960912848
2 changed files with 20 additions and 0 deletions

View file

@ -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 linked(const net::hostport &) noexcept;
bool avail(const net::hostport &) noexcept; // exists() && !errant()
peer &find(const net::hostport &);

View file

@ -235,6 +235,25 @@ noexcept
false;
}
bool
ircd::server::linked(const net::hostport &hostport)
noexcept
{
const auto hostcanon
{
server::canonize(hostport)
};
const auto it
{
peers.find(hostcanon)
};
return it != end(peers)?
it->second->link_count():
false;
}
bool
ircd::server::errant(const net::hostport &hostport)
noexcept