From 2b4e6603247b713ff80c47d5bd1c8a4960418f3f Mon Sep 17 00:00:00 2001 From: Toby Date: Sat, 24 Apr 2021 18:13:30 -0700 Subject: [PATCH] Remove pointless udpMinTimeout --- pkg/relay/udp.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/pkg/relay/udp.go b/pkg/relay/udp.go index 4992aa3..cc37830 100644 --- a/pkg/relay/udp.go +++ b/pkg/relay/udp.go @@ -11,8 +11,6 @@ import ( const udpBufferSize = 65535 -const udpMinTimeout = 4 * time.Second - var ErrTimeout = errors.New("inactivity timeout") type UDPRelay struct { @@ -41,8 +39,6 @@ func NewUDPRelay(hyClient *core.Client, listen, remote string, timeout time.Dura } if timeout == 0 { r.Timeout = 1 * time.Minute - } else if timeout < udpMinTimeout { - r.Timeout = udpMinTimeout } return r, nil } @@ -101,7 +97,7 @@ func (r *UDPRelay) ListenAndServe() error { go func() { for { ttl := ent.Deadline.Load().(time.Time).Sub(time.Now()) - if ttl < 0 { + if ttl <= 0 { // Time to die connMapMutex.Lock() _ = hyConn.Close()