mirror of
https://github.com/matrix-construct/construct
synced 2024-12-26 07:23:53 +01:00
ircd::net: Tweak stringification of net::hostport.
This commit is contained in:
parent
dbc2ca3b64
commit
7db86a58c2
1 changed files with 13 additions and 7 deletions
20
ircd/net.cc
20
ircd/net.cc
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue