Fix closing attach streams on lost tcp connection
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
parent
d7569f07e6
commit
3b3d686788
1 changed files with 4 additions and 0 deletions
|
@ -51,6 +51,7 @@ func (bp *BytesPipe) Write(p []byte) (int, error) {
|
||||||
bp.mu.Lock()
|
bp.mu.Lock()
|
||||||
|
|
||||||
written := 0
|
written := 0
|
||||||
|
loop0:
|
||||||
for {
|
for {
|
||||||
if bp.closeErr != nil {
|
if bp.closeErr != nil {
|
||||||
bp.mu.Unlock()
|
bp.mu.Unlock()
|
||||||
|
@ -85,6 +86,9 @@ func (bp *BytesPipe) Write(p []byte) (int, error) {
|
||||||
// make sure the buffer doesn't grow too big from this write
|
// make sure the buffer doesn't grow too big from this write
|
||||||
for bp.bufLen >= blockThreshold {
|
for bp.bufLen >= blockThreshold {
|
||||||
bp.wait.Wait()
|
bp.wait.Wait()
|
||||||
|
if bp.closeErr != nil {
|
||||||
|
continue loop0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// add new byte slice to the buffers slice and continue writing
|
// add new byte slice to the buffers slice and continue writing
|
||||||
|
|
Loading…
Reference in a new issue