more outbounds

This commit is contained in:
Meo597
2026-07-04 01:20:27 +08:00
parent 4dd45c8417
commit f30526a60f
10 changed files with 19 additions and 118 deletions
+2 -13
View File
@@ -117,19 +117,12 @@ 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) {
newCtx, newCancel = context.WithCancel(context.Background())
ctx = context.WithoutCancel(ctx)
}
ctx, cancel := context.WithCancel(ctx)
timer := signal.CancelAfterInactivity(ctx, func() {
cancel()
if newCancel != nil {
newCancel()
}
}, p.Timeouts.ConnectionIdle)
timer := signal.CancelAfterInactivity(ctx, cancel, p.Timeouts.ConnectionIdle)
var requestFunc func() error
var responseFunc func() error
@@ -162,10 +155,6 @@ 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)