mirror of
https://github.com/fosrl/gerbil.git
synced 2026-03-26 20:46:42 +00:00
fix(proxy): avoid shadowing ctx variable in pipe()
This commit is contained in:
@@ -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()
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user