Software /
code /
prosody
Changeset
3954:6e22b0cf3d72
net.dns: resolver:getsocket(): Return nil, err on failure
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 24 Dec 2010 04:51:34 +0000 |
parents | 3953:174edf85a916 |
children | 3955:a096700d23d9 |
files | net/dns.lua |
diffstat | 1 files changed, 5 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/net/dns.lua Fri Dec 24 04:49:30 2010 +0000 +++ b/net/dns.lua Fri Dec 24 04:51:34 2010 +0000 @@ -602,7 +602,11 @@ 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