From c50ba8f56c4ee2b5be410e8504ad6286ce0fcee3 Mon Sep 17 00:00:00 2001 From: Netch Date: Sat, 14 Aug 2021 09:12:32 +0800 Subject: [PATCH] Update aiodns --- Other/aiodns/main.go | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/Other/aiodns/main.go b/Other/aiodns/main.go index 9882ca8d..42887689 100644 --- a/Other/aiodns/main.go +++ b/Other/aiodns/main.go @@ -30,9 +30,9 @@ var ( CDNS = dns.Client{} ODNS = dns.Client{} - mux *dns.ServeMux - tcpSocket net.Listener - udpSocket net.PacketConn + mux *dns.ServeMux = nil + tcpSocket net.Listener = nil + udpSocket net.PacketConn = nil ) //export aiodns_dial @@ -130,7 +130,17 @@ func aiodns_init() bool { //export aiodns_free func aiodns_free() { + if tcpSocket != nil { + tcpSocket.Close() + tcpSocket = nil + } + if udpSocket != nil { + udpSocket.Close() + udpSocket = nil + } + + mux = nil } func handleServerName(w dns.ResponseWriter, m *dns.Msg) {