Merge branch 'issue1663' into develop

This commit is contained in:
nicolargo 2020-08-19 10:10:10 +02:00
commit 4b7681a1ce
2 changed files with 18 additions and 5 deletions

View File

@ -209,10 +209,23 @@ class GlancesAutoDiscoverClient(object):
address_family = socket.getaddrinfo(zeroconf_bind_address, args.port)[0][0]
# Start the zeroconf service
try:
self.info = ServiceInfo(
zeroconf_type, '{}:{}.{}'.format(hostname, args.port, zeroconf_type),
address=socket.inet_pton(address_family, zeroconf_bind_address),
zeroconf_type, '{}:{}.{}'.format(
hostname, args.port, zeroconf_type),
address=socket.inet_pton(
address_family, zeroconf_bind_address),
port=args.port, weight=0, priority=0, properties={}, server=hostname)
except TypeError:
# Manage issue 1663 with breaking change on ServiceInfo method
# address (only one address) is replaced by addresses (list of addresses)
self.info = ServiceInfo(
zeroconf_type, '{}:{}.{}'.format(
hostname, args.port, zeroconf_type),
addresses=[socket.inet_pton(
address_family, zeroconf_bind_address)],
port=args.port, weight=0, priority=0, properties={}, server=hostname)
try:
self.zeroconf.register_service(self.info)
except socket.error as e:

View File

@ -25,4 +25,4 @@ sparklines
statsd
wifi
zeroconf==0.19.1; python_version < "3.0"
zeroconf; python_version >= "3.0"
zeroconf>=0.28; python_version >= "3.0"