Fix "YesHandler" in design.md
This commit is contained in:
13
design.md
13
design.md
@@ -414,20 +414,21 @@ private:
|
|||||||
class YesHandler : public ConnectionHandler {
|
class YesHandler : public ConnectionHandler {
|
||||||
public:
|
public:
|
||||||
void on_connection_established(Connection &conn) override {
|
void on_connection_established(Connection &conn) override {
|
||||||
// Start writing immediately
|
// Write an initial "y\n"
|
||||||
on_write_progress(conn);
|
conn.appendMessage("y\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_write_progress(std::unique_ptr<Connection> &conn_ptr) override {
|
void on_write_progress(std::unique_ptr<Connection> &conn) override {
|
||||||
|
if (conn->outgoingBytesQueued() == 0) {
|
||||||
|
// Don't use an unbounded amount of memory
|
||||||
|
conn->reset();
|
||||||
// Write "y\n" repeatedly
|
// Write "y\n" repeatedly
|
||||||
if (conn_ptr->outgoingBytesQueued() == 0)
|
conn->appendMessage("y\n");
|
||||||
conn_ptr->appendMessage("y\n");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
### Arena-Based String Handling
|
### Arena-Based String Handling
|
||||||
```cpp
|
```cpp
|
||||||
// Preferred: Zero-copy string view with arena allocation
|
// Preferred: Zero-copy string view with arena allocation
|
||||||
|
|||||||
Reference in New Issue
Block a user