Stream clients operate on a copy of the intnernal self._outputs dict (#38766)

pull/38770/head
Eric Severance 2020-08-11 14:20:43 -07:00 committed by GitHub
parent 5355fcaba8
commit 4d1ef02802
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

@ -2,6 +2,7 @@
import logging
import secrets
import threading
from types import MappingProxyType
import voluptuous as vol
@ -137,8 +138,10 @@ class Stream:
@property
def outputs(self):
"""Return stream outputs."""
return self._outputs
"""Return a copy of the stream 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):
"""Add provider output stream."""