0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-29 10:12:39 +01:00

modules/console: Command to only iterate peers with errors.

This commit is contained in:
Jason Volk 2018-04-13 19:12:20 -07:00
parent 7360999b30
commit b95c27826b

View file

@ -939,6 +939,42 @@ console_cmd__peer(opt &out, const string_view &line)
return true; return true;
} }
bool
console_cmd__peer__error(opt &out, const string_view &line)
{
for(const auto &pair : ircd::server::peers)
{
using std::setw;
using std::left;
using std::right;
const auto &host{pair.first};
assert(bool(pair.second));
const auto &peer{*pair.second};
if(!peer.err_has())
continue;
const net::ipport &ipp{peer.remote};
out << setw(40) << right << host;
if(ipp)
out << ' ' << setw(22) << left << ipp;
else
out << ' ' << setw(22) << left << " ";
out << peer.e->etime;
if(peer.err_msg())
out << " :" << peer.err_msg();
else
out << " <unknown error>"_sv;
out << 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)
{ {