mirror of
https://github.com/matrix-construct/construct
synced 2025-02-19 18:20:19 +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,7 +3939,8 @@ ircd::net::string(const mutable_buffer &buf,
|
|||
if(need_bracket)
|
||||
consume(out, copy(out, "["_sv));
|
||||
|
||||
consume(out, size(string(out, std::get<ipp.IP>(ipp))));
|
||||
if(ipp)
|
||||
consume(out, size(string(out, std::get<ipp.IP>(ipp))));
|
||||
|
||||
if(need_bracket)
|
||||
consume(out, copy(out, "]"_sv));
|
||||
|
|
Loading…
Add table
Reference in a new issue