Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Quentin McGaw
2026-06-04 19:17:33 +02:00
committed by GitHub
parent 81be2675b2
commit 60bee62c33
+7 -7
View File
@@ -211,13 +211,6 @@ func (c *socksConn) handleUDPAssociateRequest(ctx context.Context,
return fmt.Errorf("getting udp association addresses: %w", err) return fmt.Errorf("getting udp association addresses: %w", err)
} }
err = c.encodeSuccessResponse(c.clientConn, socksVersion, succeeded,
bindAddrType, bindAddress, bindPort)
if err != nil {
c.encodeFailedResponse(c.clientConn, socksVersion, generalServerFailure)
return fmt.Errorf("writing successful %s response: %w", udpAssociate, err)
}
association, err := c.udpRouter.registerAssociation(c.clientConn, expectedAddrPort) association, err := c.udpRouter.registerAssociation(c.clientConn, expectedAddrPort)
if err != nil { if err != nil {
c.encodeFailedResponse(c.clientConn, socksVersion, generalServerFailure) c.encodeFailedResponse(c.clientConn, socksVersion, generalServerFailure)
@@ -225,6 +218,13 @@ func (c *socksConn) handleUDPAssociateRequest(ctx context.Context,
} }
defer c.udpRouter.unregisterAssociation(association) defer c.udpRouter.unregisterAssociation(association)
err = c.encodeSuccessResponse(c.clientConn, socksVersion, succeeded,
bindAddrType, bindAddress, bindPort)
if err != nil {
c.encodeFailedResponse(c.clientConn, socksVersion, generalServerFailure)
return fmt.Errorf("writing successful %s response: %w", udpAssociate, err)
}
associationCtx, associationCancel := context.WithCancel(ctx) associationCtx, associationCancel := context.WithCancel(ctx)
defer associationCancel() defer associationCancel()