mirror of
https://github.com/matrix-construct/construct
synced 2024-11-16 15:00:51 +01:00
ircd::net::acceptor: Add a default proffer callback when none set.
This commit is contained in:
parent
4f45198308
commit
6ec9867843
2 changed files with 15 additions and 1 deletions
|
@ -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;
|
||||
|
||||
|
|
15
ircd/net.cc
15
ircd/net.cc
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue