Skip to content

Commit

Permalink
Fix concurrent discovery (#215)
Browse files Browse the repository at this point in the history
  • Loading branch information
bdraco authored Dec 6, 2021
1 parent 396d81d commit f637717
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions flux_led/scanner.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import asyncio
import contextlib
from datetime import date
import logging
import select
Expand Down Expand Up @@ -112,10 +111,7 @@ def getBulbInfo(self) -> List[FluxLEDDiscovery]:
def _create_socket(self) -> socket.socket:
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
with contextlib.suppress(Exception):
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1)
sock.bind(("", self.DISCOVERY_PORT))
sock.bind(("", 0))
sock.setblocking(False)
return sock

Expand Down

0 comments on commit f637717

Please sign in to comment.