don't catch CancelledError
This commit is contained in:
parent
c3211215df
commit
68d6b815a1
1 changed files with 2 additions and 2 deletions
|
@ -83,7 +83,7 @@ class SSDPProtocol(MulticastProtocol):
|
||||||
self._pending_searches.append(
|
self._pending_searches.append(
|
||||||
(address, packet.st, fut, self.loop.call_soon(self._send_m_search, address, packet, fut))
|
(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
|
def datagram_received(self, data: bytes, addr: Tuple[str, int]) -> None: # type: ignore
|
||||||
if addr[0] == self.bind_address:
|
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:
|
try:
|
||||||
return await protocol.m_search(address=gateway_address, timeout=timeout, datagrams=[datagram_args])
|
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))
|
raise UPnPError("M-SEARCH for {}:{} timed out".format(gateway_address, SSDP_PORT))
|
||||||
finally:
|
finally:
|
||||||
protocol.disconnect()
|
protocol.disconnect()
|
||||||
|
|
Loading…
Reference in a new issue