mirror of
https://github.com/cmz0228/hysteria-dev.git
synced 2025-06-16 01:09:51 +00:00
chore: move "disable TCP timeout for SOCKS5 UDP holder" out of the loop
This commit is contained in:
parent
cea6052309
commit
52bcc1d57b
@ -301,12 +301,12 @@ func (s *Server) handleUDP(c *net.TCPConn, r *socks5.Request) error {
|
||||
_, _ = socks5.NewReply(socks5.RepSuccess, atyp, addr, port).WriteTo(c)
|
||||
// Let UDP server do its job, we hold the TCP connection here
|
||||
go s.udpServer(udpConn, localRelayConn, hyUDP)
|
||||
if s.TCPTimeout != 0 {
|
||||
// Disable TCP timeout for UDP holder
|
||||
_ = c.SetDeadline(time.Time{})
|
||||
}
|
||||
buf := make([]byte, 1024)
|
||||
for {
|
||||
if s.TCPTimeout != 0 {
|
||||
// Disable TCP timeout for UDP holder
|
||||
_ = c.SetDeadline(time.Time{})
|
||||
}
|
||||
_, err := c.Read(buf)
|
||||
if err != nil {
|
||||
closeErr = err
|
||||
|
Loading…
x
Reference in New Issue
Block a user