fix
This commit is contained in:
@ -53,10 +53,16 @@ class DataReader:
|
|||||||
os.set_blocking(self._fd, False)
|
os.set_blocking(self._fd, False)
|
||||||
|
|
||||||
def read_available(self):
|
def read_available(self):
|
||||||
|
chunks = []
|
||||||
|
while True:
|
||||||
try:
|
try:
|
||||||
return os.read(self._fd, READ_CHUNK)
|
data = os.read(self._fd, READ_CHUNK)
|
||||||
|
if not data:
|
||||||
|
break
|
||||||
|
chunks.append(data)
|
||||||
except BlockingIOError:
|
except BlockingIOError:
|
||||||
return b""
|
break
|
||||||
|
return b"".join(chunks)
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
os.close(self._fd)
|
os.close(self._fd)
|
||||||
|
|||||||
Reference in New Issue
Block a user