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
commitb186a9c3bfb5fdb93a8a0d80d7db8ad2a1587505 (patch)
tree2b9632181ddea6e49f4295ad05162056c0400921 /net
parent4d132026d0cc13c429139a06f8096752c899711b (diff)
downloadprosody-b186a9c3bfb5fdb93a8a0d80d7db8ad2a1587505.tar.gz
prosody-b186a9c3bfb5fdb93a8a0d80d7db8ad2a1587505.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