fix(tuic): end a UDP response relay with its association

Dissociating a UDP association closed its SOCKS session, but the
response relay could be blocked opening a stream on credit the client
never grants, and only the connection's end released it. A client could
leave one such goroutine per Packet/Dissociate round, past the cap on
live associations. Each relay now runs under a context the association's
removal cancels, whichever path removes it.
This commit is contained in:
MHSanaei
2026-10-31 14:55:29 +01:00
parent 5cf2ab4f69
commit 838923058b
3 changed files with 73 additions and 1 deletions
+5
View File
@@ -922,6 +922,11 @@ func (s *Server) relayUDPResponses(
sess *udpRelaySession,
) {
defer associations.release(assocID, association)
ctx, stop := context.WithCancel(ctx)
defer stop()
if !associations.attachResponseStop(assocID, association, stop) {
return
}
buf := make([]byte, s.maxUdpRelayPacketSize+263)
var nextPktID uint16
for {