Diff

net/dns.lua @ 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
parent 5566:74ae3e7e8779
child 5731:902927f1c96f
child 6288:d122420542fb
line wrap: on
line diff
--- 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);