0
0
Fork 0
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:
Jason Volk 2019-04-15 22:46:24 -07:00
parent b51d5d1461
commit 5d04c8c607

View file

@ -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)