From 68d6b815a1a148a03d08b39fe81a9cd4fc6e1482 Mon Sep 17 00:00:00 2001 From: Jack Robison Date: Mon, 21 Oct 2019 19:01:47 -0400 Subject: [PATCH] don't catch CancelledError --- aioupnp/protocols/ssdp.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aioupnp/protocols/ssdp.py b/aioupnp/protocols/ssdp.py index 903d92f..ce9f8b2 100644 --- a/aioupnp/protocols/ssdp.py +++ b/aioupnp/protocols/ssdp.py @@ -83,7 +83,7 @@ class SSDPProtocol(MulticastProtocol): self._pending_searches.append( (address, packet.st, fut, self.loop.call_soon(self._send_m_search, address, packet, fut)) ) - return await asyncio.wait_for(fut, timeout) + return await asyncio.wait_for(fut, timeout, loop=self.loop) def datagram_received(self, data: bytes, addr: Tuple[str, int]) -> None: # type: ignore if addr[0] == self.bind_address: @@ -146,7 +146,7 @@ async def m_search(lan_address: str, gateway_address: str, datagram_args: Dict[s ) try: return await protocol.m_search(address=gateway_address, timeout=timeout, datagrams=[datagram_args]) - except (asyncio.TimeoutError, asyncio.CancelledError): + except asyncio.TimeoutError: raise UPnPError("M-SEARCH for {}:{} timed out".format(gateway_address, SSDP_PORT)) finally: protocol.disconnect()