S1 #11: bytes read and written, counted per network service

A Counted<> wrapper around the network clients adds what goes through
their buffer read and write to a per-service counter (IRC, Gemini, Debug
Console, Updates); the single-byte calls and print() end up there, so
each byte counts once. `net` prints the totals. For TLS it's the plain
text the service sees.

Checked on the device: a Gemini fetch counts 164,986 in (a 164,970-byte
page and its 16-byte header) and 42 out (the URL and CRLF).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EhqxQ49eCju4CzKYNjZzwT
This commit is contained in:
2026-10-06 01:10:55 +02:00
co-authored by Claude Opus 5.5
parent 1df94b684a
commit 70bb2a4137
9 changed files with 185 additions and 7 deletions
+2 -1
View File
@@ -1,4 +1,5 @@
#include "update_service.h"
#include "platform/counted_client.h"
#include <SD.h>
#include <WiFi.h>
@@ -208,7 +209,7 @@ void UpdateService::listen() {
}
}
if (listening && phase_ == Phase::Idle) {
NetworkClient client = server.accept();
Counted<NetworkClient> client(server.accept(), net::User::Updates);
if (client) {
client.setNoDelay(true);
NetSource src(client);