ircd::net::acceptor: Eliminate getpeername(2) for address already returned on accept(2).

This commit is contained in:
Jason Volk 2023-03-19 14:12:00 -07:00
parent c3c73fcbe7
commit f2626d39a7
1 changed files with 6 additions and 9 deletions

View File

@ -501,7 +501,7 @@ try
sock->local = ep;
ip::tcp::socket &sd(*sock);
a.async_accept(sd, ios::handle(accept_desc, std::move(handler)));
a.async_accept(sd, sock->remote, ios::handle(accept_desc, std::move(handler)));
++accepting;
return true;
}
@ -527,14 +527,6 @@ noexcept try
assert(accepting > 0);
assert(accepting == 1); // for now
if(likely(sock->sd.is_open()))
sock->remote = sock->sd.remote_endpoint();
const auto remote
{
remote_ipport(*sock)
};
char ecbuf[64];
log::debug
{
@ -553,6 +545,11 @@ noexcept try
return;
}
const auto remote
{
remote_ipport(*sock)
};
if(unlikely(secure && !check_handshake_limit(*sock, remote)))
{
allow(*this);