update test

This commit is contained in:
Jack Robison 2020-02-03 22:24:02 -05:00
parent bf5b5f43e3
commit 111871bb28
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2
2 changed files with 3 additions and 0 deletions

View file

@ -107,12 +107,14 @@ class BlobServerProtocol(asyncio.Protocol):
else:
self.close()
log.debug("stopped sending %s to %s:%i", blob_hash, peer_address, peer_port)
return
except (OSError, ValueError, asyncio.TimeoutError) as err:
if isinstance(err, asyncio.TimeoutError):
log.debug("timed out sending blob %s to %s", blob_hash, peer_address)
else:
log.warning("could not read blob %s to send %s:%i", blob_hash, peer_address, peer_port)
self.close()
return
finally:
self.transfer_finished.set()
else:

View file

@ -219,6 +219,7 @@ class TestBlobExchange(BlobExchangeTestBase):
server_protocol = BlobServerProtocol(self.loop, self.server_blob_manager, self.server.lbrycrd_address)
transport = asyncio.Transport(extra={'peername': ('ip', 90)})
received_data = BytesIO()
transport.is_closing = lambda: received_data.closed
transport.write = received_data.write
server_protocol.connection_made(transport)
blob_request = BlobRequest.make_request_for_blob_hash(blob_hash).serialize()