Comparison

net/dns.lua @ 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
parent 3747:7d5b135bf268
child 3955:a096700d23d9
comparison
equal deleted inserted replaced
3953:174edf85a916 3954:6e22b0cf3d72
600 self.socketset = self.socketset or {}; 600 self.socketset = self.socketset or {};
601 601
602 local sock = self.socket[servernum]; 602 local sock = self.socket[servernum];
603 if sock then return sock; end 603 if sock then return sock; end
604 604
605 sock = socket.udp(); 605 local err;
606 sock, err = socket.udp();
607 if not sock then
608 return nil, err;
609 end
606 if self.socket_wrapper then sock = self.socket_wrapper(sock, self); end 610 if self.socket_wrapper then sock = self.socket_wrapper(sock, self); end
607 sock:settimeout(0); 611 sock:settimeout(0);
608 -- todo: attempt to use a random port, fallback to 0 612 -- todo: attempt to use a random port, fallback to 0
609 sock:setsockname('*', 0); 613 sock:setsockname('*', 0);
610 sock:setpeername(self.server[servernum], 53); 614 sock:setpeername(self.server[servernum], 53);