forked from LBRYCommunity/lbry-sdk
update test
This commit is contained in:
parent
bf5b5f43e3
commit
111871bb28
2 changed files with 3 additions and 0 deletions
|
@ -107,12 +107,14 @@ class BlobServerProtocol(asyncio.Protocol):
|
||||||
else:
|
else:
|
||||||
self.close()
|
self.close()
|
||||||
log.debug("stopped sending %s to %s:%i", blob_hash, peer_address, peer_port)
|
log.debug("stopped sending %s to %s:%i", blob_hash, peer_address, peer_port)
|
||||||
|
return
|
||||||
except (OSError, ValueError, asyncio.TimeoutError) as err:
|
except (OSError, ValueError, asyncio.TimeoutError) as err:
|
||||||
if isinstance(err, asyncio.TimeoutError):
|
if isinstance(err, asyncio.TimeoutError):
|
||||||
log.debug("timed out sending blob %s to %s", blob_hash, peer_address)
|
log.debug("timed out sending blob %s to %s", blob_hash, peer_address)
|
||||||
else:
|
else:
|
||||||
log.warning("could not read blob %s to send %s:%i", blob_hash, peer_address, peer_port)
|
log.warning("could not read blob %s to send %s:%i", blob_hash, peer_address, peer_port)
|
||||||
self.close()
|
self.close()
|
||||||
|
return
|
||||||
finally:
|
finally:
|
||||||
self.transfer_finished.set()
|
self.transfer_finished.set()
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -219,6 +219,7 @@ class TestBlobExchange(BlobExchangeTestBase):
|
||||||
server_protocol = BlobServerProtocol(self.loop, self.server_blob_manager, self.server.lbrycrd_address)
|
server_protocol = BlobServerProtocol(self.loop, self.server_blob_manager, self.server.lbrycrd_address)
|
||||||
transport = asyncio.Transport(extra={'peername': ('ip', 90)})
|
transport = asyncio.Transport(extra={'peername': ('ip', 90)})
|
||||||
received_data = BytesIO()
|
received_data = BytesIO()
|
||||||
|
transport.is_closing = lambda: received_data.closed
|
||||||
transport.write = received_data.write
|
transport.write = received_data.write
|
||||||
server_protocol.connection_made(transport)
|
server_protocol.connection_made(transport)
|
||||||
blob_request = BlobRequest.make_request_for_blob_hash(blob_hash).serialize()
|
blob_request = BlobRequest.make_request_for_blob_hash(blob_hash).serialize()
|
||||||
|
|
Loading…
Reference in a new issue