fix uncaught exception in BlobServerProtocol when client disconnects during a blob transfer

This commit is contained in:
Jack Robison 2019-01-30 12:03:05 -05:00
parent 15dbe5e54e
commit ffc7fc0793
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2

View file

@ -58,7 +58,10 @@ class BlobServerProtocol(asyncio.Protocol):
responses.append(BlobDownloadResponse(incoming_blob=incoming_blob))
self.send_response(responses)
log.info("send %s to %s:%i", blob.blob_hash[:8], peer_address, peer_port)
sent = await blob.sendfile(self)
try:
sent = await blob.sendfile(self)
except ConnectionResetError:
return
log.info("sent %s (%i bytes) to %s:%i", blob.blob_hash[:8], sent, peer_address, peer_port)
if responses:
self.send_response(responses)