0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-09-28 19:58:53 +02:00

ircd::net::acceptor: Add a default proffer callback when none set.

This commit is contained in:
Jason Volk 2020-03-03 13:54:14 -08:00
parent 4f45198308
commit 6ec9867843
2 changed files with 15 additions and 1 deletions

View file

@ -67,6 +67,7 @@ struct ircd::net::acceptor
void handshake(const error_code &, const std::shared_ptr<socket>, const decltype(handshaking)::const_iterator) noexcept;
// Acceptance stack
static bool proffer_default(listener &, const ipport &);
bool check_accept_error(const error_code &ec, socket &);
void accept(const error_code &, const std::shared_ptr<socket>) noexcept;

View file

@ -1373,7 +1373,9 @@ try
}
,pcb
{
std::move(pcb)
pcb?
std::move(pcb):
proffer_default
}
,ssl
{
@ -1735,6 +1737,17 @@ ircd::net::acceptor::check_accept_error(const error_code &ec,
__builtin_unreachable();
}
/// Default proffer callback which accepts this connection and allows the
/// next accept to take place as well. This is generally overriden by a
/// user callback to control this behavior.
bool
ircd::net::acceptor::proffer_default(listener &listener,
const ipport &ipport)
{
allow(listener);
return true;
}
void
ircd::net::acceptor::handshake(const error_code &ec,
const std::shared_ptr<socket> sock,