Commit d995ce3
committed
Fix ReadableStream controller double-close crash
Guard against calling controller.close() when the stream has already
been closed by an external cancellation. This can happen when the SDK
cancels the stream before the underlying Node stream emits its 'end'
event.
- Add `closed` flag to track controller state
- Guard all controller operations with closed check
- Add `cancel()` callback to handle external cancellation
- Properly destroy the Node stream on cancellation1 parent 6a86c19 commit d995ce3
1 file changed
+16
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
241 | 241 | | |
242 | 242 | | |
243 | 243 | | |
| 244 | + | |
244 | 245 | | |
245 | 246 | | |
246 | 247 | | |
247 | | - | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
248 | 251 | | |
249 | 252 | | |
250 | | - | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
251 | 257 | | |
252 | 258 | | |
253 | | - | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
254 | 263 | | |
255 | 264 | | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
256 | 269 | | |
257 | 270 | | |
258 | 271 | | |
| |||
0 commit comments