mirror of
https://github.com/cmz0228/hysteria-dev.git
synced 2025-06-09 05:49:54 +00:00
Remove pointless udpMinTimeout
This commit is contained in:
parent
3b7aefb10d
commit
2b4e660324
@ -11,8 +11,6 @@ import (
|
|||||||
|
|
||||||
const udpBufferSize = 65535
|
const udpBufferSize = 65535
|
||||||
|
|
||||||
const udpMinTimeout = 4 * time.Second
|
|
||||||
|
|
||||||
var ErrTimeout = errors.New("inactivity timeout")
|
var ErrTimeout = errors.New("inactivity timeout")
|
||||||
|
|
||||||
type UDPRelay struct {
|
type UDPRelay struct {
|
||||||
@ -41,8 +39,6 @@ func NewUDPRelay(hyClient *core.Client, listen, remote string, timeout time.Dura
|
|||||||
}
|
}
|
||||||
if timeout == 0 {
|
if timeout == 0 {
|
||||||
r.Timeout = 1 * time.Minute
|
r.Timeout = 1 * time.Minute
|
||||||
} else if timeout < udpMinTimeout {
|
|
||||||
r.Timeout = udpMinTimeout
|
|
||||||
}
|
}
|
||||||
return r, nil
|
return r, nil
|
||||||
}
|
}
|
||||||
@ -101,7 +97,7 @@ func (r *UDPRelay) ListenAndServe() error {
|
|||||||
go func() {
|
go func() {
|
||||||
for {
|
for {
|
||||||
ttl := ent.Deadline.Load().(time.Time).Sub(time.Now())
|
ttl := ent.Deadline.Load().(time.Time).Sub(time.Now())
|
||||||
if ttl < 0 {
|
if ttl <= 0 {
|
||||||
// Time to die
|
// Time to die
|
||||||
connMapMutex.Lock()
|
connMapMutex.Lock()
|
||||||
_ = hyConn.Close()
|
_ = hyConn.Close()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user