Comparison

net/dns.lua @ 2068:1e1ee53d7f6e

net.dns: Initialize default resolver on module load (instead of on first use).
author Waqas Hussain <waqas20@gmail.com>
date Mon, 02 Nov 2009 00:52:35 +0500
parent 2067:0ed6369605bf
child 2069:72357b1c6d88
comparison
equal deleted inserted replaced
2067:0ed6369605bf 2068:1e1ee53d7f6e
887 887
888 -- module api ------------------------------------------------------ module api 888 -- module api ------------------------------------------------------ module api
889 889
890 890
891 local function resolve (func, ...) -- - - - - - - - - - - - - - resolver_get 891 local function resolve (func, ...) -- - - - - - - - - - - - - - resolver_get
892 dns._resolver = dns._resolver or dns.resolver ()
893 return func (dns._resolver, ...) 892 return func (dns._resolver, ...)
894 end 893 end
895 894
896 895
897 function dns.resolver () -- - - - - - - - - - - - - - - - - - - - - resolver 896 function dns.resolver () -- - - - - - - - - - - - - - - - - - - - - resolver
928 return resolve(resolver.cancel, ...) end 927 return resolve(resolver.cancel, ...) end
929 928
930 function dns:socket_wrapper_set (...) -- - - - - - - - - socket_wrapper_set 929 function dns:socket_wrapper_set (...) -- - - - - - - - - socket_wrapper_set
931 return resolve (resolver.socket_wrapper_set, ...) end 930 return resolve (resolver.socket_wrapper_set, ...) end
932 931
932 dns._resolver = dns.resolver ()
933 933
934 return dns 934 return dns