This repository was archived by the owner on Oct 1, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +10
-9
lines changed
Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change 11"""Add support for discovering mDNS services."""
2+ import logging
23from typing import List # noqa: F401
34
4- from zeroconf import (
5- Zeroconf ,
6- ServiceBrowser ,
7- ServiceInfo ,
8- DNSRecord ,
9- DNSPointer ,
10- ServiceStateChange ,
11- )
5+ from zeroconf import DNSPointer , DNSRecord
6+ from zeroconf import Error as ZeroconfError
7+ from zeroconf import ServiceBrowser , ServiceInfo , ServiceStateChange , Zeroconf
8+
9+ _LOGGER = logging .getLogger (__name__ )
1210
1311
1412class FastServiceBrowser (ServiceBrowser ):
@@ -51,7 +49,10 @@ def start(self):
5149 def _service_update (zeroconf , service_type , name , state_change ):
5250 if state_change == ServiceStateChange .Added :
5351 for service in services_by_type [service_type ]:
54- service .add_service (zeroconf , service_type , name )
52+ try :
53+ service .add_service (zeroconf , service_type , name )
54+ except ZeroconfError :
55+ _LOGGER .exception ("Failed to add service %s" , name )
5556 elif state_change == ServiceStateChange .Removed :
5657 for service in services_by_type [service_type ]:
5758 service .remove_service (zeroconf , service_type , name )
You can’t perform that action at this time.
0 commit comments