From fc6936609248bef0779593f708f36f1aafce85de Mon Sep 17 00:00:00 2001 From: Jack Robison Date: Fri, 21 Sep 2018 16:42:35 -0400 Subject: [PATCH] set the download manager before creating the first deferred --- lbrynet/blob/client/EncryptedFileDownloader.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lbrynet/blob/client/EncryptedFileDownloader.py b/lbrynet/blob/client/EncryptedFileDownloader.py index 48e7b6565..059382868 100644 --- a/lbrynet/blob/client/EncryptedFileDownloader.py +++ b/lbrynet/blob/client/EncryptedFileDownloader.py @@ -44,8 +44,19 @@ class EncryptedFileDownloader(CryptStreamDownloader): self.blob_manager, download_manager) def _start(self): + def check_start_succeeded(success): + if success: + self.starting = False + self.stopped = False + self.completed = False + return True + else: + return self._start_failed() + + self.download_manager = self._get_download_manager() d = self._setup_output() - d.addCallback(lambda _: CryptStreamDownloader._start(self)) + d.addCallback(lambda _: self.download_manager.start_downloading()) + d.addCallbacks(check_start_succeeded) return d def _setup_output(self):