- From: Mattias Buelens <notifications@github.com>
- Date: Mon, 07 Jun 2021 10:49:29 -0700
- To: whatwg/streams <streams@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Monday, 7 June 2021 17:50:06 UTC
> sometimes a stream would be closed by the underlying runtime due to client disconnect, and sometimes it wouldn't If you're the one implementing the source of a `ReadableStream`, you should have exclusive ownership over the `ReadableStreamDefaultController`, so only your code should be able to call `controller.close()`. The only way a consumer of your stream can cause it to become closed, is when the consumer cancels the stream. You should handle this case by implementing a `cancel()` method on the source. On the other hand, if the underlying runtime is actually calling `controller.close()` without your knowledge... then that sounds like a bad runtime behavior. It should probably cancel the stream instead to clean it up. > The same logic applies to `.cancel()` and other forms of deinit/abort/cleanup, but I haven't checked if those have the same issues. Calling `cancel()` a second time does nothing (see step 2 of [ReadableStreamCancel](https://streams.spec.whatwg.org/#readable-stream-cancel)). -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/whatwg/streams/issues/1136#issuecomment-856139393
Received on Monday, 7 June 2021 17:50:06 UTC