forked from LBRYCommunity/lbry-sdk
check lock acquired to prevent races
This commit is contained in:
parent
8b25acff6e
commit
9ecec52412
1 changed files with 1 additions and 1 deletions
|
@ -137,7 +137,7 @@ class BlobExchangeClientProtocol(asyncio.Protocol):
|
||||||
self.transport = None
|
self.transport = None
|
||||||
|
|
||||||
async def download_blob(self, blob: 'BlobFile') -> typing.Tuple[int, typing.Optional[asyncio.Transport]]:
|
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
|
return 0, self.transport
|
||||||
try:
|
try:
|
||||||
self.blob, self.writer, self._blob_bytes_received = blob, blob.open_for_writing(), 0
|
self.blob, self.writer, self._blob_bytes_received = blob, blob.open_for_writing(), 0
|
||||||
|
|
Loading…
Reference in a new issue