mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 19:27:45 +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
|
from __future__ import annotations
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
|
from contextlib import suppress
|
||||||
import logging
|
import logging
|
||||||
import socket
|
import socket
|
||||||
from typing import cast
|
from typing import cast
|
||||||
@ -150,7 +151,12 @@ async def async_create_upnp_datagram_endpoint(
|
|||||||
ssdp_socket.setblocking(False)
|
ssdp_socket.setblocking(False)
|
||||||
|
|
||||||
# Required for receiving multicast
|
# 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)
|
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(
|
ssdp_socket.setsockopt(
|
||||||
socket.SOL_IP, socket.IP_MULTICAST_IF, socket.inet_aton(host_ip_addr)
|
socket.SOL_IP, socket.IP_MULTICAST_IF, socket.inet_aton(host_ip_addr)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user