diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2009-03-08 12:47:33 +0000 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2009-03-08 12:47:33 +0000 |
| commit | bb3a55d080f7da2dbcd2813c582cfd9e608ec3b3 (patch) | |
| tree | 5a0b275d8e324005e84d22f35444c1dcea6661fc /src | |
| parent | 6187d6e5066da813e62ea43fc1b2f05e0441136c (diff) | |
2009-03-08 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Throw exception if same infohash torrent is now downloading.
* src/RequestGroup.cc
Diffstat (limited to 'src')
| -rw-r--r-- | src/RequestGroup.cc | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/RequestGroup.cc b/src/RequestGroup.cc index adc50835..d12d1b3f 100644 --- a/src/RequestGroup.cc +++ b/src/RequestGroup.cc @@ -209,6 +209,12 @@ void RequestGroup::createInitialCommand(std::deque<Command*>& commands, throw DownloadFailureException ("Cancel BitTorrent download in dry-run context."); } + SharedHandle<BtRegistry> btRegistry = e->getBtRegistry(); + if(!btRegistry->getBtContext(btContext->getInfoHashAsString()).isNull()) { + throw DownloadFailureException + (StringFormat("InfoHash %s is already registered.", + btContext->getInfoHashAsString().c_str()).str()); + } if(e->_requestGroupMan->isSameFileBeingDownloaded(this)) { throw DownloadFailureException @@ -231,8 +237,6 @@ void RequestGroup::createInitialCommand(std::deque<Command*>& commands, _pieceStorage, _option)); - SharedHandle<BtRegistry> btRegistry = e->getBtRegistry(); - btRegistry->registerBtContext(btContext->getInfoHashAsString(), btContext); btRegistry->registerPieceStorage(btContext->getInfoHashAsString(), |
