mirror of
https://github.com/matrix-construct/construct
synced 2024-11-19 00:10:59 +01:00
ircd::net: Shortcut string creation on closed / lame sockets.
This commit is contained in:
parent
b51d5d1461
commit
5d04c8c607
1 changed files with 8 additions and 1 deletions
|
@ -191,6 +191,9 @@ ircd::net::ipport
|
|||
ircd::net::remote_ipport(const socket &socket)
|
||||
noexcept try
|
||||
{
|
||||
if(!opened(socket))
|
||||
return {};
|
||||
|
||||
const auto &ep(socket.remote());
|
||||
return make_ipport(ep);
|
||||
}
|
||||
|
@ -203,6 +206,9 @@ ircd::net::ipport
|
|||
ircd::net::local_ipport(const socket &socket)
|
||||
noexcept try
|
||||
{
|
||||
if(!opened(socket))
|
||||
return {};
|
||||
|
||||
const auto &ep(socket.local());
|
||||
return make_ipport(ep);
|
||||
}
|
||||
|
@ -3933,6 +3939,7 @@ ircd::net::string(const mutable_buffer &buf,
|
|||
if(need_bracket)
|
||||
consume(out, copy(out, "["_sv));
|
||||
|
||||
if(ipp)
|
||||
consume(out, size(string(out, std::get<ipp.IP>(ipp))));
|
||||
|
||||
if(need_bracket)
|
||||
|
|
Loading…
Reference in a new issue