From f86380a6d2a3ea91c915114e8e686e79f6b1e418 Mon Sep 17 00:00:00 2001 From: Jason Date: Sat, 10 Aug 2019 22:48:32 +0800 Subject: [PATCH] optimize timeout check --- proxy/socks/udp.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/proxy/socks/udp.go b/proxy/socks/udp.go index 1171cd6..2192ffc 100644 --- a/proxy/socks/udp.go +++ b/proxy/socks/udp.go @@ -74,9 +74,10 @@ func (h *udpHandler) fetchUDPInput(conn core.UDPConn, input net.PacketConn) { input.SetDeadline(time.Now().Add(h.timeout)) n, _, err := input.ReadFrom(buf) if err != nil { - if err, ok := err.(net.Error); ok && !err.Timeout() { - log.Warnf("read remote failed: %v", err) + if err, ok := err.(net.Error); ok && err.Timeout() { + return } + log.Warnf("read remote failed: %v", err) return }