frawau / aiozeroconf

An asyncio/pure python implementation of multicast DNS service discovery
GNU Lesser General Public License v2.1
25 stars 6 forks source link

Fixing sender sockets poor handling #9

Closed RouquinBlanc closed 5 years ago

RouquinBlanc commented 5 years ago

Since the sending of messages out of sender sockets was changed to being handled in executors, we started having frequent stack traces upon sending packets.

socket.sendto is not thread safe and this isn't how asyncio should deal with non blocking send.

Changed the code to wrap every sender socket in an asyncio transport, so that sending is dealt with asynchronously.

frawau commented 5 years ago

Yes.. I had done a quick fix because I really did not like blocking IO's in there. I was planning to get to a Protocol eventually, but thanks for fixing this before me.