Skip to content

Commit af5e363

Browse files
committed
Remove duplicates from all interfaces list
It has been mentioned in GH python-zeroconf#12 that the list of all machine's network interfaces can contain duplicates; it shouldn't break anything but there's no need to open multiple sockets in such case.
1 parent 463428f commit af5e363

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

zeroconf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1205,12 +1205,12 @@ class InterfaceChoice(enum.Enum):
12051205

12061206

12071207
def get_all_addresses(address_family):
1208-
return [
1208+
return list(set(
12091209
addr['addr']
12101210
for iface in netifaces.interfaces()
12111211
for addr in netifaces.ifaddresses(iface).get(address_family, [])
12121212
if addr.get('netmask') != HOST_ONLY_NETWORK_MASK
1213-
]
1213+
))
12141214

12151215

12161216
def normalize_interface_choice(choice, address_family):

0 commit comments

Comments
 (0)