@cryptotaxi247 / kubo / commits / 0938471d1

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

Juan Batiz-Benet committed Dec 24, 2014 at 05:50 UTC 0938471d1c6d65d3c0efb72dd033fdb05faaf566
1 file changed +2 -2
util/ctx/ctxio.go
+2 -2
@@ -45,7 +45,7 @@ func (w *ctxWriter) Write(buf []byte) (int, error) {
45 buf2 := make([]byte, len(buf))
46 copy(buf2, buf)
47
48 - c := make(chan ioret)
48 + c := make(chan ioret, 1)
49
50 go func() {
51 n, err := w.w.Write(buf2)
@@ -92,7 +92,7 @@ func NewReader(ctx context.Context, r io.Reader) *ctxReader {
92 func (r *ctxReader) Read(buf []byte) (int, error) {
93 buf2 := make([]byte, len(buf))
94
95 - c := make(chan ioret)
95 + c := make(chan ioret, 1)
96
97 go func() {
98 n, err := r.r.Read(buf2)