catch IOError when writing

This commit is contained in:
Kay Kurokawa 2017-09-15 14:17:34 -04:00 committed by Jack Robison
parent 85f25a8d99
commit ea49cddf52
No known key found for this signature in database
GPG key ID: 284699E7404E3CFF

View file

@ -51,7 +51,14 @@ class ClientProtocol(Protocol, TimeoutMixin):
self.setTimeout(None)
self._rate_limiter.report_dl_bytes(len(data))
if self._downloading_blob is True:
self._blob_download_request.write(data)
try:
self._blob_download_request.write(data)
except IOError as e:
#TODO: we need to fix this so that we do not even
#attempt to download the same blob from different peers
msg = "Failed to write, blob is likely closed by another peer finishing download"
log.warn(msg)
self.transport.loseConnection()
else:
self._response_buff += data
if len(self._response_buff) > conf.settings['MAX_RESPONSE_INFO_SIZE']: