0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-17 23:40:57 +01:00

ircd::server: Simplify and conform loghead format.

This commit is contained in:
Jason Volk 2019-07-19 20:27:17 -07:00
parent c7bd5687f2
commit feaa05157e

View file

@ -1646,15 +1646,30 @@ ircd::server::loghead(const mutable_buffer &buf,
const link &link) const link &link)
{ {
thread_local char rembuf[2][64]; thread_local char rembuf[2][64];
const auto local
{
link.socket?
string(rembuf[0], local_ipport(*link.socket)):
string_view{}
};
const auto remote
{
link.socket?
string(rembuf[1], remote_ipport(*link.socket)):
string_view{}
};
return fmt::sprintf return fmt::sprintf
{ {
buf, "socket:%lu local[%s] remote[%s] link:%lu peer:%lu", buf, "socket:%lu local:%s remote:%s link:%lu peer:%lu",
link.socket? link.socket?
link.socket->id : 0UL, link.socket->id : 0UL,
link.socket? local?
string(rembuf[0], local_ipport(*link.socket)): string_view{"0.0.0.0"}, local : "0.0.0.0"_sv,
link.socket? remote?
string(rembuf[0], remote_ipport(*link.socket)): string_view{"0.0.0.0"}, remote : "0.0.0.0"_sv,
link.id, link.id,
link.peer? link.peer?
link.peer->id: 0UL, link.peer->id: 0UL,