From c924f57df3443f1a7b855057c07c3963124d4564 Mon Sep 17 00:00:00 2001 From: gospider <2216403312@qq.com> Date: Fri, 1 Aug 2025 11:38:17 +0800 Subject: [PATCH] sync --- conn.go | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/conn.go b/conn.go index 8fbaccb..ea44ba9 100644 --- a/conn.go +++ b/conn.go @@ -20,14 +20,15 @@ func taskMain(conn http1.Conn, task *reqTask) (err error) { err = err2 } } - if err == nil { - task.cnl(tools.ErrNoErr) - } else { + if err != nil { task.cnl(err) - } - - if err == nil && task.reqCtx.response != nil && task.reqCtx.response.Body != nil { - if bodyCtx := task.reqCtx.response.Body.(*http1.Body).Context(); bodyCtx != nil { + } else { + var bodyCtx context.Context + if task.reqCtx.response != nil && task.reqCtx.response.Body != nil { + bodyCtx = task.reqCtx.response.Body.(*http1.Body).Context() + } + task.cnl(tools.ErrNoErr) + if bodyCtx != nil { select { case <-task.reqCtx.Context().Done(): if context.Cause(task.reqCtx.Context()) != tools.ErrNoErr {