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 | b186a9c3bfb5fdb93a8a0d80d7db8ad2a1587505 (patch) | |
tree | 2b9632181ddea6e49f4295ad05162056c0400921 | |
parent | 4d132026d0cc13c429139a06f8096752c899711b (diff) | |
download | prosody-b186a9c3bfb5fdb93a8a0d80d7db8ad2a1587505.tar.gz prosody-b186a9c3bfb5fdb93a8a0d80d7db8ad2a1587505.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 |