etingof / pysnmp

Python SNMP library
http://snmplabs.com/pysnmp/
BSD 2-Clause "Simplified" License
583 stars 201 forks source link

DNS oversight in asyncio examples #33

Open sonicisthebest opened 7 years ago

sonicisthebest commented 7 years ago

Hi. Neat library.

Just testing things out using asyncio and I noticed some blocking code in the asyncio examples. It seems that UdpTransportTarget((host, port)) is calling to resolve DNS in a blocking manor, which causes delay on the asyncio event loop.

Looks like the asyncio version may need a coroutine based DNS resolution. Perhaps using https://docs.python.org/3.5/library/asyncio-eventloop.html#asyncio.AbstractEventLoop.getaddrinfo

etingof commented 7 years ago

Indeed! I will fix that eventually. Unless you come up with a PR before. ;)

lextm commented 2 months ago

Fixed and will ship in the next 7.0.x release.