mirror of
https://github.com/XTLS/Xray-core.git
synced 2026-10-08 14:58:00 +03:00
Socks inbound: Fix stats for UDP Associate traffic (#7101)
https://github.com/XTLS/Xray-core/pull/7101#pullrequestreview-5452526703 --------- Co-authored-by: 风扇滑翔翼 <Fangliding.fshxy@outlook.com>
This commit is contained in:
@@ -170,9 +170,17 @@ func (s *Server) processTCP(ctx context.Context, conn stat.Connection, dispatche
|
||||
return errors.New("UDP associate with listen port failed")
|
||||
}
|
||||
tempUDPConn.SetTimeout(plcy.Timeouts.ConnectionIdle)
|
||||
var udpConn stat.Connection = tempUDPConn
|
||||
if counters, ok := conn.(*stat.CounterConnection); ok {
|
||||
udpConn = &stat.CounterConnection{
|
||||
Connection: tempUDPConn,
|
||||
ReadCounter: counters.ReadCounter,
|
||||
WriteCounter: counters.WriteCounter,
|
||||
}
|
||||
}
|
||||
errCh := make(chan error, 1)
|
||||
go func() {
|
||||
errCh <- s.handleUDPPayload(ctx, tempUDPConn, dispatcher)
|
||||
errCh <- s.handleUDPPayload(ctx, udpConn, dispatcher)
|
||||
}()
|
||||
// Associated TCP keeps the UDP alive
|
||||
// Close UDP if TCP connection is closed
|
||||
|
||||
Reference in New Issue
Block a user