Try to cleanup clients even if the stream is dead.

Hope Gemini 3.5 Pro is not lying to me :P
This commit is contained in:
2026-08-05 05:25:36 +08:00
parent 2a288f0aec
commit b8aae421fa
+5
View File
@@ -221,6 +221,11 @@ func clientHandler(w http.ResponseWriter, r *http.Request) {
ch := NewClientChannel(name)
defer ch.Close()
for {
select {
case <-r.Context().Done():
fmt.Printf("Connection to client %s closed. Cleanup the channel.\n", remote)
default:
}
chunk := <-ch.Data
_, err := w.Write(chunk)
if err != nil {