Skip to content

Commit

Permalink
Fixes for previous commit
Browse files Browse the repository at this point in the history
*sigh*
  • Loading branch information
JesusFreke committed Apr 11, 2020
1 parent 4f7daf1 commit 194671c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions fusion_idea_addin.py
Expand Up @@ -505,21 +505,22 @@ def server_bind(self):
if hasattr(socket, "if_nameindex"):
# An error is thrown if we try to use INADDR_ANY on mac. But the loopback interface does work, so we
# have that going for us. It's typically called lo0, but we'll look for "lo", or "loNNN" just in case.
name_pattern = re.compile(")
found_iface = False
for (index, name) in socket.if_nameindex():
if re.fullmatch("^lo[0-9]+$", name):
req = struct.pack("=16si", socket.inet_pton(socket.AF_INET6, self.MULTICAST_ADDR), index)
self.socket.setsockopt(IPPROTO_V6, socket.IPV6_JOIN_GROUP, req)
found_iface = True
break
if not found_iface:
if not found_iface:
logger.fatal("Could not start ssdp server")
else:
# On windows, hopefully we can rely on INADDR_ANY choosing an appropriate interface.interface.
# We don't really care what interface, because the java side seems to send a packet on all possible
# interfaces (from watching wireshark at least..), but since it's a node-local multicast address, the
# packet shouldn't actually be sent to any network, regardless of which interface is used.
req = struct.pack("=16si", socket.inet_pton(socket.AF_INET6, self.MULTICAST_ADDR), socket.INADDR_ANY)
self.socket.setsockopt(IPPROTO_V6, socket.IPV6_JOIN_GROUP, req)

def handle_error(self, request, client_address):
logger.error("An error occurred while processing ssdp request.", exc_info=sys.exc_info())
Expand Down

0 comments on commit 194671c

Please sign in to comment.