aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2019-10-27 11:33:23 +0100
committerAnton Khirnov <anton@khirnov.net>2019-10-27 11:33:23 +0100
commit70a727b610d99222360ac09869b75d1caa50bd21 (patch)
tree9ed78b0811b967904e988aa15ac054e9e9591473
parent078c6314f8da4676d5e967bb66941c7c531f4470 (diff)
Fix premature EOF on reading from cache.
-rwxr-xr-xdash_server.py8
1 files 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: