|
|
@ -447,40 +447,3 @@ class DNSResolver(object): |
|
|
|
if self._sock: |
|
|
|
self._sock.close() |
|
|
|
self._sock = None |
|
|
|
|
|
|
|
|
|
|
|
def test(): |
|
|
|
logging.getLogger('').handlers = [] |
|
|
|
logging.basicConfig(level=logging.DEBUG, |
|
|
|
format='%(asctime)s %(levelname)-8s %(message)s', |
|
|
|
datefmt='%Y-%m-%d %H:%M:%S', filemode='a+') |
|
|
|
|
|
|
|
def _callback(address, error): |
|
|
|
print error, address |
|
|
|
|
|
|
|
loop = eventloop.EventLoop() |
|
|
|
resolver = DNSResolver() |
|
|
|
resolver.add_to_loop(loop) |
|
|
|
|
|
|
|
for hostname in ['www.google.com', |
|
|
|
'8.8.8.8', |
|
|
|
'localhost', |
|
|
|
'activate.adobe.com', |
|
|
|
'www.twitter.com', |
|
|
|
'ipv6.google.com', |
|
|
|
'ipv6.l.google.com', |
|
|
|
'www.gmail.com', |
|
|
|
'r4---sn-3qqp-ioql.googlevideo.com', |
|
|
|
'www.baidu.com', |
|
|
|
'www.a.shifen.com', |
|
|
|
'm.baidu.jp', |
|
|
|
'www.youku.com', |
|
|
|
'www.twitter.com', |
|
|
|
'ipv6.google.com']: |
|
|
|
resolver.resolve(hostname, _callback) |
|
|
|
|
|
|
|
loop.run() |
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__': |
|
|
|
test() |
|
|
|