Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
| ... | ... |
@@ -51,6 +51,7 @@ func (bp *BytesPipe) Write(p []byte) (int, error) {
|
| 51 | 51 |
bp.mu.Lock() |
| 52 | 52 |
|
| 53 | 53 |
written := 0 |
| 54 |
+loop0: |
|
| 54 | 55 |
for {
|
| 55 | 56 |
if bp.closeErr != nil {
|
| 56 | 57 |
bp.mu.Unlock() |
| ... | ... |
@@ -85,6 +86,9 @@ func (bp *BytesPipe) Write(p []byte) (int, error) {
|
| 85 | 85 |
// make sure the buffer doesn't grow too big from this write |
| 86 | 86 |
for bp.bufLen >= blockThreshold {
|
| 87 | 87 |
bp.wait.Wait() |
| 88 |
+ if bp.closeErr != nil {
|
|
| 89 |
+ continue loop0 |
|
| 90 |
+ } |
|
| 88 | 91 |
} |
| 89 | 92 |
|
| 90 | 93 |
// add new byte slice to the buffers slice and continue writing |