0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-25 08:12:37 +01:00

ircd::net: Tweak stringification of net::hostport.

This commit is contained in:
Jason Volk 2019-03-18 17:39:21 -07:00
parent dbc2ca3b64
commit 7db86a58c2

View file

@ -3792,18 +3792,24 @@ ircd::string_view
ircd::net::string(const mutable_buffer &buf,
const hostport &hp)
{
if(empty(service(hp)))
if(empty(service(hp)) && port(hp) == 0)
return fmt::sprintf
{
buf, "%s", host(hp)
};
if(!empty(service(hp)))
return fmt::sprintf
{
buf, "%s:%s", host(hp), service(hp)
};
if(empty(service(hp)) && port(hp) != 0)
return fmt::sprintf
{
buf, "%s:%u", host(hp), port(hp)
};
if(port(hp) == 0)
return fmt::sprintf
{
buf, "%s (%s)", host(hp), service(hp)
};
return fmt::sprintf
{
buf, "%s:%u (%s)", host(hp), port(hp), service(hp)