Fix aiohttp connection reset errors (#15577)

* Fix aiohttp connection reset errors

* Update aiohttp_client.py

* Update aiohttp_client.py

* Update __init__.py

* Update mjpeg.py

* Update mjpeg.py

* Update ffmpeg.py

* Update ffmpeg.py

* Update ffmpeg.py

* Update proxy.py

* Update __init__.py

* Update aiohttp_client.py

* Update aiohttp_client.py

* Update proxy.py

* Update proxy.py

* Fix await inside coroutine

* Fix async syntax

* Lint
This commit is contained in:
Pascal Vizeli authored and Paulus Schoutsen committed 2018-07-23 14:36:36 +02:00
1 parent 8213b1476f
commit f3dfc433c2
5 files changed
+46 -69

No files matched your search

+5 -10
View File
@@ -191,8 +191,8 @@ class ProxyCamera(Camera):
stream_coro = websession.get(url, headers=self._headers)
if not self._stream_opts:
await async_aiohttp_proxy_web(self.hass, request, stream_coro)
return
return await async_aiohttp_proxy_web(
self.hass, request, stream_coro)
response = aiohttp.web.StreamResponse()
response.content_type = ('multipart/x-mixed-replace; '
@@ -229,15 +229,10 @@ class ProxyCamera(Camera):
_resize_image, image, self._stream_opts)
await write(image)
data = data[jpg_end + 2:]
except asyncio.CancelledError:
_LOGGER.debug("Stream closed by frontend.")
req.close()
response = None
raise
finally:
if response is not None:
await response.write_eof()
req.close()
return response
@property
def name(self):