Ensure service browser does not collapse on bad dns names (#38851)
If a device on the network presented a bad name, zeroconf would throw zeroconf.BadTypeInNameException and the service browser would die off. We now trap the exception and continue.
This commit is contained in:
1 parent
276874c414
commit
0d4331829c
2 files changed
+28
-2
No files matched your search
@@ -8,6 +8,7 @@ import voluptuous as vol
|
||||
from zeroconf import (
|
||||
DNSPointer,
|
||||
DNSRecord,
|
||||
Error as ZeroconfError,
|
||||
InterfaceChoice,
|
||||
IPVersion,
|
||||
NonUniqueNameException,
|
||||
@@ -208,7 +209,12 @@ def setup(hass, config):
|
||||
if state_change != ServiceStateChange.Added:
|
||||
return
|
||||
|
||||
service_info = zeroconf.get_service_info(service_type, name)
|
||||
try:
|
||||
service_info = zeroconf.get_service_info(service_type, name)
|
||||
except ZeroconfError:
|
||||
_LOGGER.exception("Failed to get info for device %s", name)
|
||||
return
|
||||
|
||||
if not service_info:
|
||||
# Prevent the browser thread from collapsing as
|
||||
# service_info can be None
|
||||
|
||||
Reference in new issue
Block a user