firewall: fix upnpc.discover() behavior that somehow now trigger an exception when cant talk to upnp device

This commit is contained in:
Alexandre Aubin 2023-05-05 00:09:09 +02:00
parent 37eac5e121
commit 224f1b1730

View file

@ -402,7 +402,13 @@ def firewall_upnp(action="status", no_refresh=False):
# Discover UPnP device(s)
logger.debug("discovering UPnP devices...")
try:
nb_dev = upnpc.discover()
except Exception as e:
logger.warning("Failed to find any UPnP device on the network")
nb_dev = -1
enabled = False
logger.debug("found %d UPnP device(s)", int(nb_dev))
if nb_dev < 1:
logger.error(m18n.n("upnp_dev_not_found"))