From 35d2d55a2786237c8bbdbcf06ba156ed62695448 Mon Sep 17 00:00:00 2001 From: Jack Robison Date: Thu, 26 Sep 2019 17:07:05 -0400 Subject: [PATCH] handle error if range request transport is reset --- lbry/lbry/stream/managed_stream.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lbry/lbry/stream/managed_stream.py b/lbry/lbry/stream/managed_stream.py index a3ad25794..38d461165 100644 --- a/lbry/lbry/stream/managed_stream.py +++ b/lbry/lbry/stream/managed_stream.py @@ -289,8 +289,8 @@ class ManagedStream: await response.prepare(request) self.streaming_responses.append((request, response)) self.streaming.set() + wrote = 0 try: - wrote = 0 async for blob_info, decrypted in self._aiter_read_stream(skip_blobs, connection_id=self.STREAMING_ID): if not wrote: decrypted = decrypted[first_blob_start_offset:] @@ -308,6 +308,9 @@ class ManagedStream: if response._eof_sent: break return response + except ConnectionResetError: + log.warning("connection was reset after sending browser %i blob bytes", wrote) + raise asyncio.CancelledError("range request transport was reset") finally: response.force_close() if (request, response) in self.streaming_responses: