mirror of
https://github.com/matrix-construct/construct
synced 2025-01-22 04:20:03 +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;
|
sock->local = ep;
|
||||||
ip::tcp::socket &sd(*sock);
|
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;
|
++accepting;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -527,14 +527,6 @@ noexcept try
|
||||||
assert(accepting > 0);
|
assert(accepting > 0);
|
||||||
assert(accepting == 1); // for now
|
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];
|
char ecbuf[64];
|
||||||
log::debug
|
log::debug
|
||||||
{
|
{
|
||||||
|
@ -553,6 +545,11 @@ noexcept try
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const auto remote
|
||||||
|
{
|
||||||
|
remote_ipport(*sock)
|
||||||
|
};
|
||||||
|
|
||||||
if(unlikely(secure && !check_handshake_limit(*sock, remote)))
|
if(unlikely(secure && !check_handshake_limit(*sock, remote)))
|
||||||
{
|
{
|
||||||
allow(*this);
|
allow(*this);
|
||||||
|
|
Loading…
Add table
Reference in a new issue