Skip to content

Commit

Permalink
if socket is closed, unblock the writer until done
Browse files Browse the repository at this point in the history
  • Loading branch information
dimkr committed Oct 14, 2024
1 parent 138e4ce commit cffff5f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions front/text/line.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,14 @@ func LineBuffered(inner io.Writer) *LineWriter {
_, err := w.inner.Write(w.buffer.Bytes())
if err != nil {
w.done <- err

// continue reading until closed, to unblock the writing routine
for {
if _, ok := <-w.c; !ok {
break
}
}

return
}

Expand Down

0 comments on commit cffff5f

Please sign in to comment.