This commit is contained in:
gospider
2025-04-27 16:34:07 +08:00
parent fe89e213eb
commit 3f1f06d9ab
2 changed files with 2 additions and 2 deletions

View File

@@ -40,7 +40,7 @@ type clientConn struct {
cnl context.CancelCauseFunc cnl context.CancelCauseFunc
} }
func newClientConn(con net.Conn, closeFunc func(error)) *clientConn { func NewClientConn(con net.Conn, closeFunc func(error)) *clientConn {
ctx, cnl := context.WithCancelCause(context.TODO()) ctx, cnl := context.WithCancelCause(context.TODO())
reader, writer := io.Pipe() reader, writer := io.Pipe()
c := &clientConn{ c := &clientConn{

View File

@@ -278,7 +278,7 @@ func (obj *roundTripper) dialConnecotr(ctx *Response, conne *connecotr, h2 bool)
return err return err
} }
} else { } else {
conne.Conn = newClientConn(conne.c, func(err error) { conne.Conn = NewClientConn(conne.c, func(err error) {
conne.forceCnl(tools.WrapError(err, "http1 client close")) conne.forceCnl(tools.WrapError(err, "http1 client close"))
}) })
} }