Add ConnectionHandler::on_post_batch

This commit is contained in:
2025-08-19 15:28:17 -04:00
parent 33fd8bb705
commit 6b7cc74a7c
3 changed files with 34 additions and 8 deletions

View File

@@ -1,6 +1,7 @@
#pragma once
#include <memory>
#include <span>
#include <string_view>
// Forward declaration to avoid circular dependency
@@ -68,4 +69,17 @@ public:
* @note May be called from an arbitrary accept thread.
*/
virtual void on_connection_closed(Connection &) {}
/**
* @brief Called after a batch of connections has been processed.
*
* This hook is called after on_data_arrived or on_write_progress has been
* called for each connection in the batch. The handler can take ownership of
* the connections by moving the unique_ptr out of the span. Any connections
* left in the span will remain owned by the server.
*
* @param batch A span of unique_ptrs to the connections in the batch.
*/
virtual void on_post_batch(std::span<std::unique_ptr<Connection>> /*batch*/) {
}
};