mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Fix emulated hue SO_REUSEPORT when creating the upnp socket for proper sharing (#86916)
Co-authored-by: J. Nick Koston <nick@koston.org> fixes undefined
This commit is contained in:
parent
d389de71f5
commit
49d7bbe55d
@ -2,6 +2,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from contextlib import suppress
|
||||
import logging
|
||||
import socket
|
||||
from typing import cast
|
||||
@ -150,7 +151,12 @@ async def async_create_upnp_datagram_endpoint(
|
||||
ssdp_socket.setblocking(False)
|
||||
|
||||
# Required for receiving multicast
|
||||
# Note: some code duplication from async_upnp_client/ssdp.py here.
|
||||
ssdp_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
||||
with suppress(AttributeError):
|
||||
ssdp_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1)
|
||||
|
||||
ssdp_socket.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
|
||||
|
||||
ssdp_socket.setsockopt(
|
||||
socket.SOL_IP, socket.IP_MULTICAST_IF, socket.inet_aton(host_ip_addr)
|
||||
|
Loading…
x
Reference in New Issue
Block a user