From: qydysky Date: Sat, 23 Mar 2024 21:12:45 +0000 (+0800) Subject: 1 X-Git-Tag: v0.28.20240323212235~1 X-Git-Url: http://127.0.0.1:8081/?a=commitdiff_plain;h=ebe2712cb75939ecec20a03827e6e191ab980326;p=part%2F.git 1 --- diff --git a/reqf/Reqf.go b/reqf/Reqf.go index 243504e..772c1b0 100644 --- a/reqf/Reqf.go +++ b/reqf/Reqf.go @@ -272,10 +272,18 @@ func (t *Req) reqf(ctx context.Context, val Rval) (err error) { } // io copy - var panicf = func(s string) { - err = errors.Join(err, errors.New(s)) + errChan := make(chan error, 3) + errChan <- pio.WithCtxCopy( + req.Context(), + t.callTree, + t.copyResBuf[:], + time.Duration(int(time.Millisecond)*writeLoopTO), io.MultiWriter(ws...), + resReadCloser, + func(s string) { errChan <- errors.New(s) }, + ) + for len(errChan) > 0 { + err = errors.Join(err, <-errChan) } - err = errors.Join(err, pio.WithCtxCopy(req.Context(), t.callTree, t.copyResBuf[:], time.Duration(int(time.Millisecond)*writeLoopTO), io.MultiWriter(ws...), resReadCloser, panicf)) if t.responBuf != nil { t.Respon = t.responBuf.Bytes()