Changeset

5730:411e9e7d8035

net.dns, net.adns: Make sure errors from net.server are propagated (thanks asterix)
author Kim Alvefur <zash@zash.se>
date Wed, 10 Jul 2013 07:45:10 +0200
parents 5728:2ecf400b194a
children 5731:902927f1c96f 5736:72a1f769c36f
files net/adns.lua net/dns.lua
diffstat 2 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/net/adns.lua	Mon Jul 08 23:59:51 2013 +0100
+++ b/net/adns.lua	Wed Jul 10 07:45:10 2013 +0200
@@ -68,9 +68,9 @@
 			resolver:servfail(conn); -- Let the magic commence
 		end
 	end
-	handler = server.wrapclient(sock, "dns", 53, listener);
+	handler, err = server.wrapclient(sock, "dns", 53, listener);
 	if not handler then
-		log("warn", "handler is nil");
+		return nil, err;
 	end
 	
 	handler.settimeout = function () end
--- a/net/dns.lua	Mon Jul 08 23:59:51 2013 +0100
+++ b/net/dns.lua	Wed Jul 10 07:45:10 2013 +0200
@@ -622,10 +622,10 @@
 
 	local err;
 	sock, err = socket.udp();
+	if sock and self.socket_wrapper then sock, err = self.socket_wrapper(sock, self); end
 	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
 	sock:setsockname('*', 0);