0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-09-29 04:08:54 +02:00

modules/console: Add client base command to explore the client::list.

This commit is contained in:
Jason Volk 2018-04-13 17:04:37 -07:00
parent 6ca4f6eec5
commit db8972c0ef

View file

@ -1104,6 +1104,53 @@ console_cmd__net__host__cache(opt &out, const string_view &line)
}
}
//
// client
//
bool
console_cmd__client(opt &out, const string_view &line)
{
for(const auto *const &client : ircd::client::list)
{
out << "client(" << (const void *)client << ")"
<< " socket(" << client->sock.get() << ")"
<< " " << local(*client)
<< " " << remote(*client);
if(bool(client->sock))
{
const auto stat
{
net::bytes(*client->sock)
};
out << " OUT: " << stat.second
<< " IN: " << stat.first;
}
if(client->longpoll)
out << " LONGPOLL";
if(client->reqctx)
out << " CTX " << id(*client->reqctx);
if(client->request.user_id)
out << " USER " << client->request.user_id;
if(client->request.origin)
out << " PEER " << client->request.origin;
if(client->request.head.method)
out << " " << client->request.head.method << ""
<< " " << client->request.head.path;
out << std::endl;
}
return true;
}
//
// key
//