on_post_batch -> on_batch_complete

This commit is contained in:
2025-08-24 11:00:20 -04:00
parent 6f1806d0b8
commit c0242317ed
5 changed files with 9 additions and 7 deletions

View File

@@ -395,7 +395,7 @@ public:
proto_data->process(data); proto_data->process(data);
} }
void on_post_batch(std::span<std::unique_ptr<Connection>> batch) override { void on_batch_complete(std::span<std::unique_ptr<Connection>> batch) override {
// Process a batch of connections // Process a batch of connections
for (auto& conn_ptr : batch) { for (auto& conn_ptr : batch) {
if (conn_ptr) { if (conn_ptr) {

View File

@@ -107,6 +107,6 @@ public:
* *
* @param batch A span of unique_ptrs to the connections in the batch. * @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*/) { virtual void
} on_batch_complete(std::span<std::unique_ptr<Connection>> /*batch*/) {}
}; };

View File

@@ -50,7 +50,8 @@ void HttpHandler::on_write_buffer_drained(
on_connection_established(*conn_ptr); on_connection_established(*conn_ptr);
} }
void HttpHandler::on_post_batch(std::span<std::unique_ptr<Connection>> batch) { void HttpHandler::on_batch_complete(
std::span<std::unique_ptr<Connection>> batch) {
int readyCount = 0; int readyCount = 0;
for (int i = 0; i < int(batch.size()); ++i) { for (int i = 0; i < int(batch.size()); ++i) {
readyCount += batch[i] && batch[i]->outgoingBytesQueued() > 0; readyCount += batch[i] && batch[i]->outgoingBytesQueued() > 0;

View File

@@ -103,7 +103,8 @@ struct HttpHandler : ConnectionHandler {
void on_data_arrived(std::string_view data, void on_data_arrived(std::string_view data,
std::unique_ptr<Connection> &conn_ptr) override; std::unique_ptr<Connection> &conn_ptr) override;
void on_write_buffer_drained(std::unique_ptr<Connection> &conn_ptr) override; void on_write_buffer_drained(std::unique_ptr<Connection> &conn_ptr) override;
void on_post_batch(std::span<std::unique_ptr<Connection>> /*batch*/) override; void on_batch_complete(
std::span<std::unique_ptr<Connection>> /*batch*/) override;
// Route parsing (public for testing) // Route parsing (public for testing)
static HttpRoute parseRoute(std::string_view method, std::string_view url); static HttpRoute parseRoute(std::string_view method, std::string_view url);

View File

@@ -535,8 +535,8 @@ void Server::process_connection_batch(
} }
} }
// Call post-batch handler - handlers can take ownership here // Call batch complete handler - handlers can take ownership here
handler_.on_post_batch(batch); handler_.on_batch_complete(batch);
// Transfer all remaining connections back to epoll // Transfer all remaining connections back to epoll
for (auto &conn_ptr : batch) { for (auto &conn_ptr : batch) {