mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Stream clients operate on a copy of the intnernal self._outputs dict (#38766)
This commit is contained in:
parent
5355fcaba8
commit
4d1ef02802
@ -2,6 +2,7 @@
|
|||||||
import logging
|
import logging
|
||||||
import secrets
|
import secrets
|
||||||
import threading
|
import threading
|
||||||
|
from types import MappingProxyType
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
@ -137,8 +138,10 @@ class Stream:
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def outputs(self):
|
def outputs(self):
|
||||||
"""Return stream outputs."""
|
"""Return a copy of the stream outputs."""
|
||||||
return self._outputs
|
# A copy is returned so the caller can iterate through the outputs
|
||||||
|
# without concern about self._outputs being modified from another thread.
|
||||||
|
return MappingProxyType(self._outputs.copy())
|
||||||
|
|
||||||
def add_provider(self, fmt):
|
def add_provider(self, fmt):
|
||||||
"""Add provider output stream."""
|
"""Add provider output stream."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user