fix(proxy): avoid shadowing ctx variable in pipe()

This commit is contained in:
Laurence
2026-03-13 15:51:23 +00:00
parent 1643d71905
commit 28c65b950c

View File

@@ -755,10 +755,10 @@ func (p *SNIProxy) selectStickyEndpoint(clientAddr string, endpoints []string) s
// pipe handles bidirectional data transfer between connections
func (p *SNIProxy) pipe(ctx context.Context, clientConn, targetConn net.Conn, clientReader io.Reader) {
g, ctx := errgroup.WithContext(ctx)
g, gCtx := errgroup.WithContext(ctx)
// Close connections when context cancels to unblock io.Copy operations
context.AfterFunc(ctx, func() {
context.AfterFunc(gCtx, func() {
clientConn.Close()
targetConn.Close()
})