[go-nuts] Re: bufio.Writer's sticky errors & lost data

2018-09-20 Thread John Floren
On Thursday, September 20, 2018 at 5:50:51 AM UTC-6, Dean Wang wrote: > > >> new connection, new underlying io.Writer, why keep the previous pending > data? > > It's a new connection to the same destination. I want the bytes I wrote to reach that destination, even if we have to negotiate a

[go-nuts] bufio.Writer's sticky errors & lost data

2018-09-19 Thread John Floren
If bufio.Writer.Flush() ever sees an error, it sets b.err and will immediately return that error on any future calls to Flush: https://golang.org/src/bufio/bufio.go?s=14569:14599#L558 Writer.Reset(w io.Writer) will clear the error and set the bufio.Writer to use the new io.Writer given, but it