mirror of
https://github.com/matrix-construct/construct
synced 2024-11-16 15:00:51 +01:00
modules/console: Add client base command to explore the client::list.
This commit is contained in:
parent
6ca4f6eec5
commit
db8972c0ef
1 changed files with 47 additions and 0 deletions
|
@ -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
|
||||
//
|
||||
|
|
Loading…
Reference in a new issue