This commit is contained in:
Jason
2019-08-07 20:37:58 +08:00
parent a25572ced6
commit b2ecae5e44
+3 -4
View File
@@ -44,7 +44,6 @@ func NewUDPHandler(proxyHost string, proxyPort uint16, timeout time.Duration, fa
fakeDns: fakeDns,
sessionStater: sessionStater,
timeout: timeout,
closed: false,
}
}
@@ -241,13 +240,13 @@ func (h *udpHandler) ReceiveTo(conn core.UDPConn, data []byte, addr *net.UDPAddr
}
func (h *udpHandler) Close(conn core.UDPConn) {
h.Lock()
defer h.Unlock()
if h.closed {
return
}
h.Lock()
defer h.Unlock()
if remoteConn, ok := h.tcpConns[conn]; ok {
remoteConn.Close()
delete(h.tcpConns, conn)