Revert "more outbounds"

This reverts commit f30526a60f.
This commit is contained in:
Meo597
2026-07-08 22:44:25 +08:00
parent dc7ae49fab
commit 93ca624bb5
10 changed files with 118 additions and 19 deletions
+13 -2
View File
@@ -117,12 +117,19 @@ func (c *Client) Process(ctx context.Context, link *transport.Link, dialer inter
errors.LogInfoInner(ctx, err, "failed to clear deadline after handshake")
}
var newCtx context.Context
var newCancel context.CancelFunc
if session.TimeoutOnlyFromContext(ctx) {
ctx = context.WithoutCancel(ctx)
newCtx, newCancel = context.WithCancel(context.Background())
}
ctx, cancel := context.WithCancel(ctx)
timer := signal.CancelAfterInactivity(ctx, cancel, p.Timeouts.ConnectionIdle)
timer := signal.CancelAfterInactivity(ctx, func() {
cancel()
if newCancel != nil {
newCancel()
}
}, p.Timeouts.ConnectionIdle)
var requestFunc func() error
var responseFunc func() error
@@ -155,6 +162,10 @@ func (c *Client) Process(ctx context.Context, link *transport.Link, dialer inter
}
}
if newCtx != nil {
ctx = newCtx
}
responseDonePost := task.OnSuccess(responseFunc, task.Close(link.Writer))
if err := task.Run(ctx, requestFunc, responseDonePost); err != nil {
return errors.New("connection ends").Base(err)