forked from LBRYCommunity/lbry-sdk
catch IOError when writing
This commit is contained in:
parent
85f25a8d99
commit
ea49cddf52
1 changed files with 8 additions and 1 deletions
|
@ -51,7 +51,14 @@ class ClientProtocol(Protocol, TimeoutMixin):
|
||||||
self.setTimeout(None)
|
self.setTimeout(None)
|
||||||
self._rate_limiter.report_dl_bytes(len(data))
|
self._rate_limiter.report_dl_bytes(len(data))
|
||||||
if self._downloading_blob is True:
|
if self._downloading_blob is True:
|
||||||
|
try:
|
||||||
self._blob_download_request.write(data)
|
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:
|
else:
|
||||||
self._response_buff += data
|
self._response_buff += data
|
||||||
if len(self._response_buff) > conf.settings['MAX_RESPONSE_INFO_SIZE']:
|
if len(self._response_buff) > conf.settings['MAX_RESPONSE_INFO_SIZE']:
|
||||||
|
|
Loading…
Reference in a new issue