Software /
code /
prosody
Comparison
net/dns.lua @ 5730:411e9e7d8035
net.dns, net.adns: Make sure errors from net.server are propagated (thanks asterix)
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 10 Jul 2013 07:45:10 +0200 |
parent | 5566:74ae3e7e8779 |
child | 5731:902927f1c96f |
child | 6288:d122420542fb |
comparison
equal
deleted
inserted
replaced
5728:2ecf400b194a | 5730:411e9e7d8035 |
---|---|
620 local sock = self.socket[servernum]; | 620 local sock = self.socket[servernum]; |
621 if sock then return sock; end | 621 if sock then return sock; end |
622 | 622 |
623 local err; | 623 local err; |
624 sock, err = socket.udp(); | 624 sock, err = socket.udp(); |
625 if sock and self.socket_wrapper then sock, err = self.socket_wrapper(sock, self); end | |
625 if not sock then | 626 if not sock then |
626 return nil, err; | 627 return nil, err; |
627 end | 628 end |
628 if self.socket_wrapper then sock = self.socket_wrapper(sock, self); end | |
629 sock:settimeout(0); | 629 sock:settimeout(0); |
630 -- todo: attempt to use a random port, fallback to 0 | 630 -- todo: attempt to use a random port, fallback to 0 |
631 sock:setsockname('*', 0); | 631 sock:setsockname('*', 0); |
632 sock:setpeername(self.server[servernum], 53); | 632 sock:setpeername(self.server[servernum], 53); |
633 self.socket[servernum] = sock; | 633 self.socket[servernum] = sock; |