From b843e1d5a2f139d1d0503da6329f379687847338 Mon Sep 17 00:00:00 2001 From: Andrew Noyes Date: Tue, 19 Aug 2025 16:04:20 -0400 Subject: [PATCH] Fix "YesHandler" in design.md --- design.md | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/design.md b/design.md index 474a095..41e8013 100644 --- a/design.md +++ b/design.md @@ -414,20 +414,21 @@ private: class YesHandler : public ConnectionHandler { public: void on_connection_established(Connection &conn) override { - // Start writing immediately - on_write_progress(conn); + // Write an initial "y\n" + conn.appendMessage("y\n"); } - void on_write_progress(std::unique_ptr &conn_ptr) override { - // Write "y\n" repeatedly - if (conn_ptr->outgoingBytesQueued() == 0) - conn_ptr->appendMessage("y\n"); + void on_write_progress(std::unique_ptr &conn) override { + if (conn->outgoingBytesQueued() == 0) { + // Don't use an unbounded amount of memory + conn->reset(); + // Write "y\n" repeatedly + conn->appendMessage("y\n"); } } }; ``` - ### Arena-Based String Handling ```cpp // Preferred: Zero-copy string view with arena allocation