From 70a727b610d99222360ac09869b75d1caa50bd21 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sun, 27 Oct 2019 11:33:23 +0100 Subject: Fix premature EOF on reading from cache. --- dash_server.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dash_server.py b/dash_server.py index 1b9e1cd..5ed4fd2 100755 --- a/dash_server.py +++ b/dash_server.py @@ -143,13 +143,13 @@ class DataStream: def read(self, chunk): with self._data_cond: - while self._eof is False and len(self._data) <= chunk: + while self._eof is False and chunk >= len(self._data): self._data_cond.wait() - if self._eof: - return bytes() + if chunk < len(self._data): + return self._data[chunk] - return self._data[chunk] + return bytes() class StreamCache: -- cgit v1.2.3