From 9de7354ea016e829531c4a1f9d94c4fcc4677d54 Mon Sep 17 00:00:00 2001 From: Jack Date: Tue, 1 Nov 2016 16:32:34 -0400 Subject: [PATCH] drop connection on failed read blob --- lbrynet/reflector/client/client.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lbrynet/reflector/client/client.py b/lbrynet/reflector/client/client.py index 5c8516633..b72d773d7 100644 --- a/lbrynet/reflector/client/client.py +++ b/lbrynet/reflector/client/client.py @@ -407,6 +407,10 @@ class BlobReflectorClient(Protocol): 'blob_size': self.next_blob_to_send.length })) + def log_fail_and_disconnect(self, err, blob_hash): + log.error("Error reflecting blob %s", blob_hash) + self.transport.loseConnection() + def send_next_request(self): if self.file_sender is not None: # send the blob @@ -420,7 +424,7 @@ class BlobReflectorClient(Protocol): d = self.blob_manager.get_blob(blob_hash, True) d.addCallback(self.open_blob_for_reading) # send the server the next blob hash + length - d.addCallback(lambda _: self.send_blob_info()) + d.addCallbacks(lambda _: self.send_blob_info(), lambda err: self.log_fail_and_disconnect(err, blob_hash)) return d else: # close connection