udp_connect may raise error
@@ -290,15 +290,15 @@ local function connect_server()
local fd = socket.udp(function(str, from)
resolve(str)
end)
- socket.udp_connect(fd, dns_server.address, dns_server.port)
-
- if dns_server.fd then
+ local ok, err = pcall(socket.udp_connect,fd, dns_server.address, dns_server.port)
+ if not ok then
socket.close(fd)
- else
+ error(err)
+ end
+
dns_server.fd = fd
skynet.error(string.format("Udp server open %s:%s (%d)", dns_server.address, dns_server.port, fd))
end
-end
local DNS_SERVER_RETIRE = 60 * 100
local function touch_server()
