mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-11-05 12:45:00 +03:00
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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user