fixed an issue where if the machine had an IPv4 interface, it could sometime crash while checking if an address is local
This commit is contained in:
parent
cef9cea12c
commit
88f1c4cba4
1 changed files with 14 additions and 4 deletions
|
@ -242,7 +242,17 @@ class CommunicationManager:
|
|||
for interface in self.get_local_addresses():
|
||||
# unpack the interface information
|
||||
interface_family, _, _, _, interface_address = interface
|
||||
interface_host, _, _, interface_scope = interface_address
|
||||
|
||||
match interface_family:
|
||||
case socket.AF_INET:
|
||||
interface_host, interface_port = interface_address
|
||||
|
||||
# check if it matches the address interface
|
||||
if host == interface_host:
|
||||
return True
|
||||
|
||||
case socket.AF_INET6:
|
||||
interface_host, interface_port, interface_flowinfo, interface_scope = interface_address
|
||||
|
||||
# check if it matches the address interface
|
||||
if host == interface_host and scope == interface_scope:
|
||||
|
|
Loading…
Reference in a new issue