Commit 9ab0ec6
copy: setError should imply Close
If sending two messages from goroutine X:
a <- 1
b <- 2
And receiving them in goroutine Y:
select {
case <- a:
case <- b:
}
Either branch of the select can trigger first - so when we call
.setError and .Close next to each other, we don't know whether the done
channel will close first or the error channel will receive first - so
sometimes, we get an incorrect error message.
We resolve this by not sending both signals - instead, we can have
.setError *imply* .Close, by having the pushWriter call .Close on
itself, after receiving an error.
Signed-off-by: Justin Chadwell <[email protected]>1 parent 6caf174 commit 9ab0ec6
1 file changed
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
288 | 288 | | |
289 | 289 | | |
290 | 290 | | |
291 | | - | |
292 | 291 | | |
293 | 292 | | |
294 | 293 | | |
| |||
298 | 297 | | |
299 | 298 | | |
300 | 299 | | |
301 | | - | |
302 | 300 | | |
303 | 301 | | |
304 | 302 | | |
| |||
431 | 429 | | |
432 | 430 | | |
433 | 431 | | |
| 432 | + | |
434 | 433 | | |
435 | 434 | | |
436 | 435 | | |
| |||
488 | 487 | | |
489 | 488 | | |
490 | 489 | | |
| 490 | + | |
491 | 491 | | |
492 | 492 | | |
493 | 493 | | |
| |||
0 commit comments