-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
21 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
# | ||
# This file is part of Glances. | ||
# | ||
# Copyright (C) 2019 Nicolargo <[email protected]> | ||
# Copyright (C) 2021 Nicolargo <[email protected]> | ||
# | ||
# Glances is free software; you can redistribute it and/or modify | ||
# it under the terms of the GNU Lesser General Public License as published by | ||
|
@@ -211,21 +211,30 @@ def __init__(self, hostname, args=None): | |
# 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), | ||
port=args.port, weight=0, priority=0, properties={}, server=hostname) | ||
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) | ||
|
||
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: | ||
|