0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-28 00:14:07 +01:00

modules/console: Improve formatting for client list output.

This commit is contained in:
Jason Volk 2018-04-14 16:26:57 -07:00
parent 756840b42c
commit ee5c1f27f2

View file

@ -1155,12 +1155,16 @@ console_cmd__net__host__cache(opt &out, const string_view &line)
bool bool
console_cmd__client(opt &out, const string_view &line) console_cmd__client(opt &out, const string_view &line)
{ {
using std::setw;
using std::left;
using std::right;
for(const auto *const &client : ircd::client::list) for(const auto *const &client : ircd::client::list)
{ {
out << "client(" << (const void *)client << ")" out << setw(8) << left << client->id
<< " socket(" << client->sock.get() << ")" << " " << right << setw(22) << local(*client)
<< " " << local(*client) << " " << left << setw(22) << remote(*client)
<< " " << remote(*client); ;
if(bool(client->sock)) if(bool(client->sock))
{ {
@ -1169,15 +1173,16 @@ console_cmd__client(opt &out, const string_view &line)
net::bytes(*client->sock) net::bytes(*client->sock)
}; };
out << " OUT: " << stat.second out << " | UP " << setw(8) << right << stat.second
<< " IN: " << stat.first; << " | DN " << setw(8) << right << stat.first
<< " |";
} }
if(client->longpoll)
out << " LONGPOLL";
if(client->reqctx) if(client->reqctx)
out << " CTX " << id(*client->reqctx); out << " CTX " << setw(4) << id(*client->reqctx);
if(client->longpoll)
out << " POLL";
if(client->request.user_id) if(client->request.user_id)
out << " USER " << client->request.user_id; out << " USER " << client->request.user_id;