mirror of
https://github.com/matrix-construct/construct
synced 2024-12-28 16:34:13 +01:00
modules/console: Add cmds to count peers and DNS cache entries.
This commit is contained in:
parent
a5d014d10a
commit
b30a637dfa
1 changed files with 64 additions and 0 deletions
|
@ -2196,6 +2196,22 @@ console_cmd__peer(opt &out, const string_view &line)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
console_cmd__peer__count(opt &out, const string_view &line)
|
||||||
|
{
|
||||||
|
size_t i{0};
|
||||||
|
for(const auto &pair : ircd::server::peers)
|
||||||
|
{
|
||||||
|
assert(bool(pair.second));
|
||||||
|
const auto &peer{*pair.second};
|
||||||
|
if(!peer.err_has())
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
|
||||||
|
out << i << std::endl;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
console_cmd__peer__error(opt &out, const string_view &line)
|
console_cmd__peer__error(opt &out, const string_view &line)
|
||||||
{
|
{
|
||||||
|
@ -2232,6 +2248,22 @@ console_cmd__peer__error(opt &out, const string_view &line)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
console_cmd__peer__error__count(opt &out, const string_view &line)
|
||||||
|
{
|
||||||
|
size_t i{0};
|
||||||
|
for(const auto &pair : ircd::server::peers)
|
||||||
|
{
|
||||||
|
assert(bool(pair.second));
|
||||||
|
const auto &peer{*pair.second};
|
||||||
|
if(peer.err_has())
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
|
||||||
|
out << i << std::endl;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
console_cmd__peer__error__clear__all(opt &out, const string_view &line)
|
console_cmd__peer__error__clear__all(opt &out, const string_view &line)
|
||||||
{
|
{
|
||||||
|
@ -2483,6 +2515,22 @@ console_cmd__net__host__cache__A(opt &out, const string_view &line)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
console_cmd__net__host__cache__A__count(opt &out, const string_view &line)
|
||||||
|
{
|
||||||
|
size_t count[2] {0};
|
||||||
|
for(const auto &pair : net::dns::cache.A)
|
||||||
|
{
|
||||||
|
const auto &host{pair.first};
|
||||||
|
const auto &record{pair.second};
|
||||||
|
++count[bool(record.ip4)];
|
||||||
|
}
|
||||||
|
|
||||||
|
out << "resolved: " << count[1] << std::endl;
|
||||||
|
out << "error: " << count[0] << std::endl;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
console_cmd__net__host__cache__SRV(opt &out, const string_view &line)
|
console_cmd__net__host__cache__SRV(opt &out, const string_view &line)
|
||||||
{
|
{
|
||||||
|
@ -2505,6 +2553,22 @@ console_cmd__net__host__cache__SRV(opt &out, const string_view &line)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
console_cmd__net__host__cache__SRV__count(opt &out, const string_view &line)
|
||||||
|
{
|
||||||
|
size_t count[2] {0};
|
||||||
|
for(const auto &pair : net::dns::cache.SRV)
|
||||||
|
{
|
||||||
|
const auto &host{pair.first};
|
||||||
|
const auto &record{pair.second};
|
||||||
|
++count[bool(record.tgt)];
|
||||||
|
}
|
||||||
|
|
||||||
|
out << "resolved: " << count[1] << std::endl;
|
||||||
|
out << "error: " << count[0] << std::endl;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
console_cmd__net__host__prefetch(opt &out, const string_view &line)
|
console_cmd__net__host__prefetch(opt &out, const string_view &line)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue