mirror of
https://github.com/matrix-construct/construct
synced 2025-01-05 20:34:29 +01:00
ircd::net::acceptor: Eliminate getpeername(2) for address already returned on accept(2).
This commit is contained in:
parent
c3c73fcbe7
commit
f2626d39a7
1 changed files with 6 additions and 9 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue