mirror of
https://github.com/fosrl/gerbil.git
synced 2026-03-27 13:06:39 +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
|
// pipe handles bidirectional data transfer between connections
|
||||||
func (p *SNIProxy) pipe(ctx context.Context, clientConn, targetConn net.Conn, clientReader io.Reader) {
|
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
|
// Close connections when context cancels to unblock io.Copy operations
|
||||||
context.AfterFunc(ctx, func() {
|
context.AfterFunc(gCtx, func() {
|
||||||
clientConn.Close()
|
clientConn.Close()
|
||||||
targetConn.Close()
|
targetConn.Close()
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user