From 0b60027dacf331c103f764b7b1b5dee8b6123938 Mon Sep 17 00:00:00 2001 From: Victor Shyba Date: Wed, 11 Jan 2017 18:31:34 -0300 Subject: [bug] handle error once Handle it only if self.deferred wasnt called yet, otherwise that's just an out-of-sync call from a scheduled deferred. Since it was already logged, it's ok to ignore. --- client/src/leap/soledad/client/http_target/fetch_protocol.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/client/src/leap/soledad/client/http_target/fetch_protocol.py b/client/src/leap/soledad/client/http_target/fetch_protocol.py index fa6b1969..c7eabe2b 100644 --- a/client/src/leap/soledad/client/http_target/fetch_protocol.py +++ b/client/src/leap/soledad/client/http_target/fetch_protocol.py @@ -63,6 +63,8 @@ class DocStreamReceiver(ReadBodyProtocol): Deliver the accumulated response bytes to the waiting L{Deferred}, if the response body has been completely received without error. """ + if self.deferred.called: + return try: if reason.check(ResponseDone): self.dataBuffer = self.metadata @@ -125,11 +127,7 @@ class DocStreamReceiver(ReadBodyProtocol): else: d = self._doc_reader( self.current_doc, line.strip() or None, self.total) - d.addErrback(self._error) - - def _error(self, reason): - logger.error(reason) - self.transport.loseConnection() + d.addErrback(self.deferred.errback) def finish(self): """ -- cgit v1.2.3