Changeset

4022:79eff2476596

net.dns: resolver:getsocket(): Return nil, err on failure
author Matthew Wild <mwild1@gmail.com>
date Fri, 24 Dec 2010 04:51:34 +0000
parents 4021:5af5fdaaa940
children 4023:7910f36e2791
files net/dns.lua
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
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