From ea49cddf52ac6a085fffef4413e35a6d7ccb98a9 Mon Sep 17 00:00:00 2001 From: Kay Kurokawa Date: Fri, 15 Sep 2017 14:17:34 -0400 Subject: [PATCH] catch IOError when writing --- lbrynet/core/client/ClientProtocol.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lbrynet/core/client/ClientProtocol.py b/lbrynet/core/client/ClientProtocol.py index 86b27277b..9d77a841a 100644 --- a/lbrynet/core/client/ClientProtocol.py +++ b/lbrynet/core/client/ClientProtocol.py @@ -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']: