Commit 0938471d authored by Juan Batiz-Benet's avatar Juan Batiz-Benet

ctxio: fix buffer of 1 so goroutine exits when io completes.

parent 989d3d4c
......@@ -45,7 +45,7 @@ func (w *ctxWriter) Write(buf []byte) (int, error) {
buf2 := make([]byte, len(buf))
copy(buf2, buf)
c := make(chan ioret)
c := make(chan ioret, 1)
go func() {
n, err := w.w.Write(buf2)
......@@ -92,7 +92,7 @@ func NewReader(ctx context.Context, r io.Reader) *ctxReader {
func (r *ctxReader) Read(buf []byte) (int, error) {
buf2 := make([]byte, len(buf))
c := make(chan ioret)
c := make(chan ioret, 1)
go func() {
n, err := r.r.Read(buf2)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment