Remove ProcessResult

This commit is contained in:
2025-08-19 13:41:26 -04:00
parent e832d8419c
commit 455ab749a6
4 changed files with 11 additions and 43 deletions

View File

@@ -135,7 +135,6 @@ Key features:
Key features:
- process_data() with unique_ptr<Connection>& for ownership transfer
- ProcessResult enum for connection lifecycle control (Continue/CloseAfterSend/CloseNow)
- on_connection_established/closed() hooks for protocol state management
- Zero-copy data processing with arena allocator integration
- Thread-safe ownership transfer via Server::releaseBackToServer()
@@ -280,7 +279,6 @@ The modular design allows each component to be optimized independently while mai
- Implement `process_data()` with proper ownership semantics
- Use connection's arena allocator for temporary allocations: `conn->getArena()`
- Handle partial messages and streaming protocols appropriately
- Return appropriate `ProcessResult` for connection lifecycle management
- Use `Server::releaseBackToServer()` if taking ownership for async processing
- Add corresponding test cases and integration tests
- Consider performance implications of ownership transfers
@@ -334,7 +332,7 @@ auto server = Server::create(config, handler);
```cpp
class HttpHandler : public ConnectionHandler {
public:
ProcessResult process_data(std::string_view data, std::unique_ptr<Connection>& conn_ptr) override {
void process_data(std::string_view data, std::unique_ptr<Connection>& conn_ptr) override {
// Parse HTTP request using connection's arena
ArenaAllocator& arena = conn_ptr->getArena();
@@ -342,7 +340,6 @@ public:
conn_ptr->appendMessage("HTTP/1.1 200 OK\r\n\r\nHello World");
// Server retains ownership
return ProcessResult::CloseAfterSend;
}
};
```
@@ -351,7 +348,7 @@ public:
```cpp
class AsyncHandler : public ConnectionHandler {
public:
ProcessResult process_data(std::string_view data, std::unique_ptr<Connection>& conn_ptr) override {
void process_data(std::string_view data, std::unique_ptr<Connection>& conn_ptr) override {
// Take ownership for async processing
auto connection = std::move(conn_ptr); // conn_ptr is now null
@@ -362,8 +359,6 @@ public:
// Return ownership to server when done
Server::releaseBackToServer(std::move(connection));
});
return ProcessResult::Continue; // Server won't continue processing (conn_ptr is null)
}
};
```