This commit is contained in:
Davte 2020-04-19 19:41:06 +02:00
parent a381805c3c
commit 05cc3cb8e6

View File

@ -82,7 +82,6 @@ class Server:
continue
input_data = await reader.read(self.buffer_chunk_size)
if connection_token not in self.buffers:
print("Here!")
break
self.buffers[connection_token].append(input_data)
except ConnectionResetError as e:
@ -101,12 +100,14 @@ class Server:
# Slow down if buffer is empty; after 1.5 s of silence, break
consecutive_interruptions += 1
if consecutive_interruptions > 3:
print("Too many interruptions")
break
await asyncio.sleep(.5)
continue
else:
consecutive_interruptions = 0
if not input_data:
print("No input data received")
break
try:
writer.write(input_data)