|
void | on (event::disconnected &&e) |
| Handler for disconnection events.
|
| acceptor () noexcept |
| Constructor.
|
| ~acceptor ()=default |
| Destructor.
|
void | on (typename Protocol::message &&new_socket) |
| Handler for new connections.
|
bool | listen (qb::io::uri uri, std::filesystem::path cert_file={}, std::filesystem::path key_file={}, std::vector< std::string > alpn_protocols={}) |
| Listen for incoming connections on a given URI.
|
| input ()=default |
| Default constructor.
|
| input (IProtocol *protocol) noexcept |
| Constructor with an initial protocol instance.
|
| input (input const &)=delete |
| Deleted copy constructor to prevent unintended copying of I/O state and resources.
|
| ~input () noexcept |
| Destructor.
|
_Protocol * | switch_protocol (_Args &&...args) |
| Switches to a new protocol for processing input, taking ownership of the new protocol.
|
void | clear_protocols () |
| Clears all owned protocol instances.
|
IProtocol * | protocol () |
| Gets a pointer to the current active protocol instance.
|
void | start () noexcept |
| Starts asynchronous input operations.
|
void | ready_to_read () noexcept |
| Ensures the I/O watcher is listening for read events (EV_READ).
|
void | disconnect (int reason=1) |
| Initiates a graceful disconnection of the input component.
|
template<typename _Derived, typename _Prot>
class qb::io::async::tcp::acceptor< _Derived, _Prot >
Handles accepting incoming TCP connections asynchronously.
This template class provides functionality for accepting incoming TCP connections in an asynchronous manner. It uses the input class for asynchronous operations and a protocol for accepting and processing incoming connections. When a new connection is accepted, it passes the new socket to the derived class for handling.
- Template Parameters
-
_Derived | The derived class type (CRTP pattern) |
_Prot | The protocol class type to use with the acceptor |
template<typename _Derived, typename _Prot>
Handler for disconnection events.
This method is called when the acceptor is disconnected. If the derived class has a handler for disconnection events, it forwards the event to that handler. Otherwise, it throws a runtime error.
- Parameters
-
- Exceptions
-
std::runtime_error | If the derived class doesn't handle disconnection |