Skip to content

Commit

Permalink
fix: fix issue with the asyncqt event loop
Browse files Browse the repository at this point in the history
Previously, we erroneously passed down the raw socket.socket instance to
loop.add_readre and loop.remove_reader. Now, we pass down a file descriptor.

Apparently, other event loops handle the socket.socket type just fine. Still,
this type is not part of the offical loop API.

See also: harvimt/quamash#71
  • Loading branch information
frederikaalund committed Jun 30, 2020
1 parent b7bb05c commit 9dfdf37
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions asyncio_mqtt/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,11 +242,11 @@ def _on_publish(self, client, userdata, mid):
def _on_socket_open(self, client, userdata, sock):
def cb():
client.loop_read()
self._loop.add_reader(sock, cb)
self._loop.add_reader(sock.fileno(), cb)
self._misc_task = self._loop.create_task(self._misc_loop())

def _on_socket_close(self, client, userdata, sock):
self._loop.remove_reader(sock)
self._loop.remove_reader(sock.fileno())
with suppress(asyncio.CancelledError):
self._misc_task.cancel()

Expand Down

0 comments on commit 9dfdf37

Please sign in to comment.