From e837470a6a6b4e8473e52c10381ceccd7b76a808 Mon Sep 17 00:00:00 2001 From: Dreamacro <305009791@qq.com> Date: Thu, 16 May 2019 18:40:20 +0800 Subject: [PATCH] Fix: udp crash in tunnel --- tunnel/tunnel.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tunnel/tunnel.go b/tunnel/tunnel.go index 1a95eefa..faeaf46d 100644 --- a/tunnel/tunnel.go +++ b/tunnel/tunnel.go @@ -159,10 +159,11 @@ func (t *Tunnel) handleConn(localConn C.ServerAdapter) { if metadata.NetWork == C.UDP { pc, addr, err := proxy.DialUDP(metadata) - defer pc.Close() if err != nil { log.Warnln("Proxy[%s] connect [%s --> %s] error: %s", proxy.Name(), metadata.SrcIP.String(), metadata.String(), err.Error()) + return } + defer pc.Close() t.handleUDPOverTCP(localConn, pc, addr) return