From 9ecec524129cd40c718b5b69c6ff11ec26deb334 Mon Sep 17 00:00:00 2001 From: Victor Shyba Date: Fri, 8 Feb 2019 04:39:28 -0300 Subject: [PATCH] check lock acquired to prevent races --- lbrynet/blob_exchange/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lbrynet/blob_exchange/client.py b/lbrynet/blob_exchange/client.py index 40b197707..80d78fb22 100644 --- a/lbrynet/blob_exchange/client.py +++ b/lbrynet/blob_exchange/client.py @@ -137,7 +137,7 @@ class BlobExchangeClientProtocol(asyncio.Protocol): self.transport = None async def download_blob(self, blob: 'BlobFile') -> typing.Tuple[int, typing.Optional[asyncio.Transport]]: - if blob.get_is_verified() or blob.file_exists: + if blob.get_is_verified() or blob.file_exists or blob.blob_write_lock.locked(): return 0, self.transport try: self.blob, self.writer, self._blob_bytes_received = blob, blob.open_for_writing(), 0