reactie van server

This commit is contained in:
2026-09-13 13:13:33 +02:00
parent 72d072bb6c
commit 2114e11f90
5 changed files with 110 additions and 28 deletions
-12
View File
@@ -29,15 +29,9 @@ class Connection final {
std::uint32_t desiredEvents;
};
// ByteBuffer::CAPACITY is 64 KiB.
// At most 16 KiB are copied per 48 KiB appended: 16 / 48 = 1 / 3.
// A lower threshold reduces copying but leaves less unread work available.
// The 16 KiB value is a fixed compromise, not a measured optimum.
static constexpr std::size_t LOW_WATERMARK = 16uz * 1024;
explicit Connection(FileDescriptor socket);
// Each Connection has a unique identity and remains in its original slot.
Connection(const Connection&) = delete;
Connection& operator=(const Connection&) = delete;
Connection(Connection&&) = delete;
@@ -52,14 +46,8 @@ class Connection final {
void close() noexcept { socket_.reset(); }
private:
// recv() returning zero means the client has finished sending data.
// readClosed_ records this. receive() still returns true because this
// is not an error and the socket may still send its buffered response.
// Only a recv() error returns false.
bool receive();
bool transmit();
// TEMP echo path: queues received bytes unchanged for sending back to
// the client.
void forwardReceivedBytes();
FileDescriptor socket_;