mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-08-04 13:47:37 +02:00
lock before iterating web sockets
This commit is contained in:
parent
f2d1f7b00f
commit
a7ecc2af4b
@ -68,9 +68,19 @@ class BroadcastThread(threading.Thread):
|
|||||||
while True:
|
while True:
|
||||||
buf = self.converter.read(65536)
|
buf = self.converter.read(65536)
|
||||||
if buf:
|
if buf:
|
||||||
for ws in self.websocket_server.manager:
|
manager = self.websocket_server.manager
|
||||||
if ws.environ["PATH_INFO"].endswith(self.camera):
|
with manager.lock:
|
||||||
ws.send(buf, binary=True)
|
websockets = manager.websockets.copy()
|
||||||
|
ws_iter = iter(websockets.values())
|
||||||
|
|
||||||
|
for ws in ws_iter:
|
||||||
|
if not ws.terminated and ws.environ["PATH_INFO"].endswith(
|
||||||
|
self.camera
|
||||||
|
):
|
||||||
|
try:
|
||||||
|
ws.send(buf, binary=True)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
elif self.converter.process.poll() is not None:
|
elif self.converter.process.poll() is not None:
|
||||||
break
|
break
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user