From c095dadafd33da7de56adda77857ca0f96ccaea3 Mon Sep 17 00:00:00 2001 From: John Furrow Date: Sun, 11 Jun 2017 20:41:02 -0700 Subject: [PATCH] Fix bug in multi-file downloads --- server/models/client.js | 6 +----- server/services/torrentService.js | 4 ++++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/server/models/client.js b/server/models/client.js index 681ee9bd..5bb7692e 100644 --- a/server/models/client.js +++ b/server/models/client.js @@ -79,11 +79,7 @@ var client = { downloadFiles(hash, files, res) { try { - let selectedTorrent = null; - - this.getTorrent({hash}, (torrent) => { - selectedTorrent = torrent; - }); + const selectedTorrent = torrentService.getTorrent(hash); this.getTorrentDetails(hash, (torrentDetails) => { const filePathsToDownload = this.findFilesByIndicies( diff --git a/server/services/torrentService.js b/server/services/torrentService.js index 011a598f..06d350c3 100644 --- a/server/services/torrentService.js +++ b/server/services/torrentService.js @@ -189,6 +189,10 @@ class TorrentService extends EventEmitter { return torrentStatus; } + getTorrent(hash) { + return this.torrentListSummary.torrents[hash]; + } + getTorrentList() { return this.torrentListSummary; }