diff --git a/lbrynet/lbrynet_daemon/LBRYDaemon.py b/lbrynet/lbrynet_daemon/LBRYDaemon.py index 08bd27d3a..8daa4f961 100644 --- a/lbrynet/lbrynet_daemon/LBRYDaemon.py +++ b/lbrynet/lbrynet_daemon/LBRYDaemon.py @@ -1754,6 +1754,7 @@ class LBRYDaemon(jsonrpc.JSONRPC): stream_info=params.stream_info, file_name=params.file_name, wait_for_write=params.wait_for_write) + # TODO: downloading can timeout. Not sure what to do when that happens d.addCallback(get_output_callback(params)) d.addCallback(lambda message: self._render_response(message, OK_CODE)) return d @@ -2411,6 +2412,13 @@ class _DownloadNameHelper(object): def _get_stream(self, stream_info): d = self.daemon.add_stream( self.name, self.timeout, self.download_directory, self.file_name, stream_info) + + def _raiseErrorOnTimeout(args): + was_successful, _, _ = args + if not was_successful: + raise Exception('What am I supposed to do with a timed-out downloader?') + d.addCallback(_raiseErrorOnTimeout) + if self.wait_for_write: d.addCallback(lambda _: self._wait_for_write()) d.addCallback(lambda _: self.daemon.streams[self.name].downloader) diff --git a/lbrynet/lbrynet_daemon/LBRYDownloader.py b/lbrynet/lbrynet_daemon/LBRYDownloader.py index 323882eaf..344c63792 100644 --- a/lbrynet/lbrynet_daemon/LBRYDownloader.py +++ b/lbrynet/lbrynet_daemon/LBRYDownloader.py @@ -76,14 +76,14 @@ class GetStream(object): # TODO: Why is this the stopping condition for the finished callback? if self.download_path: self.checker.stop() - self.finished.callback((self.stream_hash, self.download_path)) + self.finished.callback((True, self.stream_hash, self.download_path)) elif self.timeout_counter >= self.timeout: log.info("Timeout downloading lbry://%s" % self.resolved_name) self.checker.stop() self.d.cancel() self.code = STREAM_STAGES[4] - self.finished.callback(False) + self.finished.callback((False, None, None)) def _convert_max_fee(self): if isinstance(self.max_key_fee, dict):