mirror of
https://github.com/wu736139669/hapi.git
synced 2026-11-24 04:47:03 +00:00
compressSseResponse pauses zlib when the client falls behind, so a large event can leave compressed output parked in zlib's readable buffer. pull() calls gzip.resume(), which flows that buffer on a later tick. If the client disconnects in between, cancel() closes the stream and destroys zlib, but the pending flow still emits 'data' and controller.enqueue() throws "Invalid state: Controller is already closed". The throw happens inside a zlib event handler, so nothing catches it and the hub process exits. Track when the stream has finished (closed, errored or cancelled) and stop touching the controller after that. via [HAPI](https://hapi.run) Co-authored-by: HAPI <noreply@hapi.run> Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>