From c1ddf34e4bc082a0422bf26818ea73e571596660 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Thu, 26 Jul 2012 21:20:08 +0900 Subject: [PATCH] Specify torrent file explicitly in createRequestGroupForBitTorrent() --- src/RpcMethodImpl.cc | 6 +++--- src/UTMetadataPostDownloadHandler.cc | 3 ++- src/download_helper.cc | 8 +++----- src/download_helper.h | 13 +++++++++---- src/main.cc | 3 ++- test/DownloadHelperTest.cc | 13 ++++++++----- 6 files changed, 27 insertions(+), 19 deletions(-) diff --git a/src/RpcMethodImpl.cc b/src/RpcMethodImpl.cc index e8284933..e9552a20 100644 --- a/src/RpcMethodImpl.cc +++ b/src/RpcMethodImpl.cc @@ -293,13 +293,13 @@ SharedHandle AddTorrentRpcMethod::process if(util::saveAs(filename, torrentParam->s(), true)) { A2_LOG_INFO(fmt("Uploaded torrent data was saved as %s", filename.c_str())); requestOption->put(PREF_TORRENT_FILE, filename); - createRequestGroupForBitTorrent(result, requestOption, uris); } else { A2_LOG_INFO(fmt("Uploaded torrent data was not saved." " Failed to write file %s", filename.c_str())); - createRequestGroupForBitTorrent(result, requestOption, - uris, torrentParam->s()); + filename.clear(); } + createRequestGroupForBitTorrent(result, requestOption, uris, filename, + torrentParam->s()); if(!result.empty()) { return addRequestGroup(result.front(), e, posGiven, pos); diff --git a/src/UTMetadataPostDownloadHandler.cc b/src/UTMetadataPostDownloadHandler.cc index 3dd9329d..13623fc1 100644 --- a/src/UTMetadataPostDownloadHandler.cc +++ b/src/UTMetadataPostDownloadHandler.cc @@ -97,7 +97,8 @@ void UTMetadataPostDownloadHandler::getNextRequestGroups // Don't adjust announce URI because it has been done when // RequestGroup is created with magnet URI. createRequestGroupForBitTorrent(newRgs, requestGroup->getOption(), - std::vector(), torrent, false); + std::vector(), + A2STR::NIL, torrent, false); requestGroup->followedBy(newRgs.begin(), newRgs.end()); if(requestGroup->getMetadataInfo()) { setMetadataInfo(newRgs.begin(), newRgs.end(), diff --git a/src/download_helper.cc b/src/download_helper.cc index 90707cd3..adec256c 100644 --- a/src/download_helper.cc +++ b/src/download_helper.cc @@ -242,13 +242,14 @@ void createRequestGroupForBitTorrent (std::vector >& result, const SharedHandle