aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2010-12-24 04:51:34 +0000
committerMatthew Wild <mwild1@gmail.com>2010-12-24 04:51:34 +0000
commit24b4c74559e467dda5046253b8df68c77e723670 (patch)
tree649dcaf7fe232dd882a7acabf3ce5c0aaff251e1 /net
parent1246a8c3664b4faa61f3c68971f08a6b0d649b34 (diff)
downloadprosody-24b4c74559e467dda5046253b8df68c77e723670.tar.gz
prosody-24b4c74559e467dda5046253b8df68c77e723670.zip
net.dns: resolver:getsocket(): Return nil, err on failure
Diffstat (limited to 'net')
-rw-r--r--net/dns.lua6
1 files changed, 5 insertions, 1 deletions
diff --git a/net/dns.lua b/net/dns.lua
index 23a453aa..0101daa3 100644
--- a/net/dns.lua
+++ b/net/dns.lua
@@ -602,7 +602,11 @@ function resolver:getsocket(servernum) -- - - - - - - - - - - - - getsocket
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