diff --git a/filebridging/server.py b/filebridging/server.py index 166e770..564f946 100644 --- a/filebridging/server.py +++ b/filebridging/server.py @@ -73,7 +73,8 @@ class Server: def set_ssl_context(self, ssl_context: ssl.SSLContext): self._ssl_context = ssl_context - async def run_reader(self, reader, connection_token): + async def run_reader(self, reader: asyncio.StreamReader, connection_token): + received_bytes = 0 while 1: try: # Wait one second if buffer is full @@ -81,6 +82,7 @@ class Server: await asyncio.sleep(1) continue input_data = await reader.read(self.buffer_chunk_size) + received_bytes += len(input_data) if connection_token not in self.buffers: break self.buffers[connection_token].append(input_data) @@ -89,6 +91,7 @@ class Server: break except Exception as e: logging.error(f"Unexpected exception:\n{e}", exc_info=True) + print(received_bytes) async def run_writer(self, writer, connection_token): consecutive_interruptions = 0