Diff

net/dns.lua @ 3954:6e22b0cf3d72

net.dns: resolver:getsocket(): Return nil, err on failure
author Matthew Wild <mwild1@gmail.com>
date Fri, 24 Dec 2010 04:51:34 +0000
parent 3747:7d5b135bf268
child 3955:a096700d23d9
line wrap: on
line diff
--- a/net/dns.lua	Fri Dec 24 04:49:30 2010 +0000
+++ b/net/dns.lua	Fri Dec 24 04:51:34 2010 +0000
@@ -602,7 +602,11 @@
 	local sock = self.socket[servernum];
 	if sock then return sock; end
 
-	sock = socket.udp();
+	local err;
+	sock, err = socket.udp();
+	if not sock then
+		return nil, err;
+	end
 	if self.socket_wrapper then sock = self.socket_wrapper(sock, self); end
 	sock:settimeout(0);
 	-- todo: attempt to use a random port, fallback to 0