template<typename T>
T& socket, std::vector<uint8_t> data,
std::function<void(std::error_code, std::size_t)> handler,
std::function<void(bool)> bp_callback) {
{ socket.pending_bytes() } -> std::convertible_to<std::size_t>;
{ socket.is_backpressure_active() } -> std::convertible_to<bool>;
{ socket.try_send(std::move(data), handler) } -> std::convertible_to<bool>;
{ socket.set_backpressure_callback(bp_callback) } -> std::same_as<void>;
}
Concept for sockets with backpressure control.
Concept for connected stream sockets (TCP, TLS).
Concept for sockets with backpressure control.
Sockets satisfying this concept provide flow control mechanisms to prevent memory exhaustion when sending to slow receivers.
Types satisfying this concept: tcp_socket (with backpressure enabled)
Example usage:
template<BackpressureAwareSocket S>
void send_with_flow_control(S& socket, std::vector<uint8_t> data) {
if (socket.is_backpressure_active()) {
return;
}
if (!socket.try_send(std::move(data), handler)) {
}
}
Definition at line 264 of file socket_concepts.h.