8000 `Could not contact DNS servers` after a connection outage and re-establishment · Issue #124 · aio-libs/aiodns · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Could not contact DNS servers after a connection outage and re-establishment #124
Closed
@mberdyshev

Description

@mberdyshev

I changed the example from the repository description to provide infinite query retries until a successful answer:

import asyncio
import aiodns

loop = asyncio.SelectorEventLoop()
resolver = aiodns.DNSResolver(loop=loop)

async def query(name, query_type):
    while True:
        try:
            return await resolver.query(name, query_type)
        except aiodns.error.DNSError as err:
            print(err)
            await asyncio.sleep(1)

coro = query('google.com', 'A')
result = loop.run_until_complete(coro)
print(result)
loop.close()

Let's assume my Windows machine has some network problems before the script run - I mockup this with the following cmd command:

netsh wlan add filter permission=block ssid="<Wi-Fi ssid>" networktype=infrastructure

When the script starts it constantly outputs (11, 'Could not contact DNS servers') as expected. But even if the network connection is re-established (netsh wlan delete filter <...>) during the script run, it still outputs the error. I can get the answer only if I stop and rerun the script.

I have also opened the issue on pycares tracker - saghul/pycares#203 .

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0