diff options
author | Matthew Wild <mwild1@gmail.com> | 2010-12-24 04:51:34 +0000 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2010-12-24 04:51:34 +0000 |
commit | 24b4c74559e467dda5046253b8df68c77e723670 (patch) | |
tree | 649dcaf7fe232dd882a7acabf3ce5c0aaff251e1 | |
parent | 1246a8c3664b4faa61f3c68971f08a6b0d649b34 (diff) | |
download | prosody-24b4c74559e467dda5046253b8df68c77e723670.tar.gz prosody-24b4c74559e467dda5046253b8df68c77e723670.zip |
net.dns: resolver:getsocket(): Return nil, err on failure
-rw-r--r-- | net/dns.lua | 6 |
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 |