2007-10-11 16:58:24 +00:00
|
|
|
/* <!-- copyright */
|
|
|
|
/*
|
|
|
|
* aria2 - The high speed download utility
|
|
|
|
*
|
|
|
|
* Copyright (C) 2006 Tatsuhiro Tsujikawa
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2010-01-05 16:01:46 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
2007-10-11 16:58:24 +00:00
|
|
|
*
|
|
|
|
* In addition, as a special exception, the copyright holders give
|
|
|
|
* permission to link the code of portions of this program with the
|
|
|
|
* OpenSSL library under certain conditions as described in each
|
|
|
|
* individual source file, and distribute linked combinations
|
|
|
|
* including the two.
|
|
|
|
* You must obey the GNU General Public License in all respects
|
|
|
|
* for all of the code used other than OpenSSL. If you modify
|
|
|
|
* file(s) with this exception, you may extend this exception to your
|
|
|
|
* version of the file(s), but you are not obligated to do so. If you
|
|
|
|
* do not wish to do so, delete this exception statement from your
|
|
|
|
* version. If you delete this exception statement from all source
|
|
|
|
* files in the program, then also delete it here.
|
|
|
|
*/
|
|
|
|
/* copyright --> */
|
|
|
|
#include "BtSetup.h"
|
2010-02-22 15:58:05 +00:00
|
|
|
|
|
|
|
#include <cstring>
|
|
|
|
|
2007-10-11 16:58:24 +00:00
|
|
|
#include "RequestGroup.h"
|
|
|
|
#include "DownloadEngine.h"
|
|
|
|
#include "Option.h"
|
|
|
|
#include "BtRegistry.h"
|
|
|
|
#include "PeerListenCommand.h"
|
|
|
|
#include "TrackerWatcherCommand.h"
|
|
|
|
#include "SeedCheckCommand.h"
|
|
|
|
#include "PeerChokeCommand.h"
|
|
|
|
#include "ActivePeerConnectionCommand.h"
|
2007-11-04 12:26:12 +00:00
|
|
|
#include "PeerListenCommand.h"
|
2007-10-11 16:58:24 +00:00
|
|
|
#include "UnionSeedCriteria.h"
|
|
|
|
#include "TimeSeedCriteria.h"
|
|
|
|
#include "ShareRatioSeedCriteria.h"
|
|
|
|
#include "prefs.h"
|
2007-11-04 12:26:12 +00:00
|
|
|
#include "LogFactory.h"
|
|
|
|
#include "Logger.h"
|
2009-10-22 15:35:33 +00:00
|
|
|
#include "util.h"
|
2007-11-21 16:14:40 +00:00
|
|
|
#include "IntSequence.h"
|
2008-02-01 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Added DHT functionality, compatible with mainline.
DHT is disabled by default. To enable it, give --enable-dht to
aria2c.
You may need to specify entry point to DHT network using
--dht-entry-point. DHT uses UDP port to listen incoming message.
Use --dht-listen-port to specify port number. Make sure that
your
firewall configuration can pass through UDP traffic to the port.
The routing table is saved in $HOME/.aria2/dht.dat.
* src/DHT*
* src/BNode.{h, cc}
* src/PeerInteractionCommand.cc: enable DHT functionality for a
particular torrent.
* src/Data.cc: Rewritten ctor.
* src/OptionHandlerFactory.cc: Added --enable-dht,
--dht-listen-port,
--dht-entry-point.
* src/DefaultBtInteractive.cc: Send port message if dht is
enabled.
* src/RequestGroup.cc: Initialize DHT functionality. When
download
ends, remove BtContext from DHTPeerAnnounceStorage.
* src/BtPortMessage.{h, cc}: Rewritten.
* src/message.h
* src/OptionHandlerImpl.cc
* src/option_processing.cc: Added --enable-dht,
--dht-listen-port,
--dht-entry-point.
* src/Dictionary.{h, cc} (remove): New function.
* src/prefs.h
* src/DefaultBtMessageFactory.h
* src/BtHandshakeMessage.cc
* src/ActivePeerConnectionCommand.cc
* src/SocketCore.{h, cc}: Added datagram socket support.
* src/DefaultBtMessageFactory.cc
* src/BtSetup.cc: Add BtContext to DHTPeerAnnounceStorage here.
Create DHT commands.
* src/BtMessageFactory.h
* src/PeerMessageUtil.{h, cc}
2008-02-01 17:36:33 +00:00
|
|
|
#include "DHTGetPeersCommand.h"
|
|
|
|
#include "DHTPeerAnnounceStorage.h"
|
|
|
|
#include "DHTSetup.h"
|
|
|
|
#include "DHTRegistry.h"
|
2010-08-07 14:15:21 +00:00
|
|
|
#include "DHTNode.h"
|
|
|
|
#include "DHTRoutingTable.h"
|
|
|
|
#include "DHTTaskQueue.h"
|
|
|
|
#include "DHTTaskFactory.h"
|
|
|
|
#include "DHTTokenTracker.h"
|
|
|
|
#include "DHTMessageDispatcher.h"
|
|
|
|
#include "DHTMessageReceiver.h"
|
|
|
|
#include "DHTMessageFactory.h"
|
|
|
|
#include "DHTMessageCallback.h"
|
2008-11-03 06:49:02 +00:00
|
|
|
#include "BtProgressInfoFile.h"
|
|
|
|
#include "BtAnnounce.h"
|
2009-04-05 10:38:15 +00:00
|
|
|
#include "BtRuntime.h"
|
2009-06-28 10:37:15 +00:00
|
|
|
#include "bittorrent_helper.h"
|
2009-07-05 03:11:51 +00:00
|
|
|
#include "BtStopDownloadCommand.h"
|
2010-02-20 14:23:25 +00:00
|
|
|
#include "LpdReceiveMessageCommand.h"
|
|
|
|
#include "LpdDispatchMessageCommand.h"
|
|
|
|
#include "LpdMessageReceiver.h"
|
|
|
|
#include "LpdMessageDispatcher.h"
|
|
|
|
#include "message.h"
|
|
|
|
#include "SocketCore.h"
|
2010-06-18 14:47:09 +00:00
|
|
|
#include "DlAbortEx.h"
|
2010-08-14 06:52:35 +00:00
|
|
|
#include "array_fun.h"
|
2010-11-14 07:17:55 +00:00
|
|
|
#include "DownloadContext.h"
|
|
|
|
#include "PieceStorage.h"
|
|
|
|
#include "PeerStorage.h"
|
2010-11-20 08:21:36 +00:00
|
|
|
#include "fmt.h"
|
2007-11-04 12:26:12 +00:00
|
|
|
|
2008-02-08 15:53:45 +00:00
|
|
|
namespace aria2 {
|
|
|
|
|
2010-11-20 08:21:36 +00:00
|
|
|
BtSetup::BtSetup() {}
|
2007-10-11 16:58:24 +00:00
|
|
|
|
2010-02-28 12:30:11 +00:00
|
|
|
void BtSetup::setup(std::vector<Command*>& commands,
|
2010-01-05 16:01:46 +00:00
|
|
|
RequestGroup* requestGroup,
|
|
|
|
DownloadEngine* e,
|
|
|
|
const Option* option)
|
2007-10-11 16:58:24 +00:00
|
|
|
{
|
2009-11-22 14:37:05 +00:00
|
|
|
if(!requestGroup->getDownloadContext()->hasAttribute(bittorrent::BITTORRENT)){
|
2008-05-11 09:36:39 +00:00
|
|
|
return;
|
2007-10-11 16:58:24 +00:00
|
|
|
}
|
2010-06-18 14:47:09 +00:00
|
|
|
SharedHandle<TorrentAttribute> torrentAttrs =
|
|
|
|
bittorrent::getTorrentAttrs(requestGroup->getDownloadContext());
|
|
|
|
bool metadataGetMode = torrentAttrs->metadata.empty();
|
2011-07-21 14:42:41 +00:00
|
|
|
const SharedHandle<BtRegistry>& btReg = e->getBtRegistry();
|
|
|
|
BtObject btObject = btReg->get(requestGroup->getGID());
|
2010-06-21 13:51:56 +00:00
|
|
|
SharedHandle<PieceStorage> pieceStorage = btObject.pieceStorage_;
|
|
|
|
SharedHandle<PeerStorage> peerStorage = btObject.peerStorage_;
|
|
|
|
SharedHandle<BtRuntime> btRuntime = btObject.btRuntime_;
|
|
|
|
SharedHandle<BtAnnounce> btAnnounce = btObject.btAnnounce_;
|
2007-10-11 16:58:24 +00:00
|
|
|
// commands
|
2008-11-03 06:49:02 +00:00
|
|
|
{
|
|
|
|
TrackerWatcherCommand* c =
|
2009-06-28 10:37:15 +00:00
|
|
|
new TrackerWatcherCommand(e->newCUID(), requestGroup, e);
|
2008-11-03 06:49:02 +00:00
|
|
|
c->setPeerStorage(peerStorage);
|
|
|
|
c->setPieceStorage(pieceStorage);
|
|
|
|
c->setBtRuntime(btRuntime);
|
|
|
|
c->setBtAnnounce(btAnnounce);
|
|
|
|
|
|
|
|
commands.push_back(c);
|
|
|
|
}
|
2009-11-22 14:37:05 +00:00
|
|
|
if(!metadataGetMode) {
|
2008-11-03 06:49:02 +00:00
|
|
|
PeerChokeCommand* c =
|
2009-06-28 10:37:15 +00:00
|
|
|
new PeerChokeCommand(e->newCUID(), e);
|
2008-11-03 06:49:02 +00:00
|
|
|
c->setPeerStorage(peerStorage);
|
|
|
|
c->setBtRuntime(btRuntime);
|
2009-11-22 14:37:05 +00:00
|
|
|
|
2008-11-03 06:49:02 +00:00
|
|
|
commands.push_back(c);
|
|
|
|
}
|
|
|
|
{
|
|
|
|
ActivePeerConnectionCommand* c =
|
2010-03-19 05:57:47 +00:00
|
|
|
new ActivePeerConnectionCommand(e->newCUID(), requestGroup, e,
|
|
|
|
metadataGetMode?2:10);
|
2008-11-03 06:49:02 +00:00
|
|
|
c->setBtRuntime(btRuntime);
|
|
|
|
c->setPieceStorage(pieceStorage);
|
|
|
|
c->setPeerStorage(peerStorage);
|
|
|
|
c->setBtAnnounce(btAnnounce);
|
2010-01-05 16:01:46 +00:00
|
|
|
|
2008-11-03 06:49:02 +00:00
|
|
|
commands.push_back(c);
|
|
|
|
}
|
2008-02-18 17:11:44 +00:00
|
|
|
|
2010-08-07 14:15:21 +00:00
|
|
|
if(metadataGetMode || !torrentAttrs->privateTorrent) {
|
|
|
|
if(DHTRegistry::isInitialized()) {
|
|
|
|
DHTGetPeersCommand* command =
|
|
|
|
new DHTGetPeersCommand(e->newCUID(), requestGroup, e);
|
|
|
|
command->setTaskQueue(DHTRegistry::getData().taskQueue);
|
|
|
|
command->setTaskFactory(DHTRegistry::getData().taskFactory);
|
|
|
|
command->setBtRuntime(btRuntime);
|
|
|
|
command->setPeerStorage(peerStorage);
|
|
|
|
commands.push_back(command);
|
|
|
|
}
|
|
|
|
if(DHTRegistry::isInitialized6()) {
|
|
|
|
DHTGetPeersCommand* command =
|
|
|
|
new DHTGetPeersCommand(e->newCUID(), requestGroup, e);
|
|
|
|
command->setTaskQueue(DHTRegistry::getData6().taskQueue);
|
|
|
|
command->setTaskFactory(DHTRegistry::getData6().taskFactory);
|
|
|
|
command->setBtRuntime(btRuntime);
|
|
|
|
command->setPeerStorage(peerStorage);
|
|
|
|
commands.push_back(command);
|
|
|
|
}
|
2008-02-01 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Added DHT functionality, compatible with mainline.
DHT is disabled by default. To enable it, give --enable-dht to
aria2c.
You may need to specify entry point to DHT network using
--dht-entry-point. DHT uses UDP port to listen incoming message.
Use --dht-listen-port to specify port number. Make sure that
your
firewall configuration can pass through UDP traffic to the port.
The routing table is saved in $HOME/.aria2/dht.dat.
* src/DHT*
* src/BNode.{h, cc}
* src/PeerInteractionCommand.cc: enable DHT functionality for a
particular torrent.
* src/Data.cc: Rewritten ctor.
* src/OptionHandlerFactory.cc: Added --enable-dht,
--dht-listen-port,
--dht-entry-point.
* src/DefaultBtInteractive.cc: Send port message if dht is
enabled.
* src/RequestGroup.cc: Initialize DHT functionality. When
download
ends, remove BtContext from DHTPeerAnnounceStorage.
* src/BtPortMessage.{h, cc}: Rewritten.
* src/message.h
* src/OptionHandlerImpl.cc
* src/option_processing.cc: Added --enable-dht,
--dht-listen-port,
--dht-entry-point.
* src/Dictionary.{h, cc} (remove): New function.
* src/prefs.h
* src/DefaultBtMessageFactory.h
* src/BtHandshakeMessage.cc
* src/ActivePeerConnectionCommand.cc
* src/SocketCore.{h, cc}: Added datagram socket support.
* src/DefaultBtMessageFactory.cc
* src/BtSetup.cc: Add BtContext to DHTPeerAnnounceStorage here.
Create DHT commands.
* src/BtMessageFactory.h
* src/PeerMessageUtil.{h, cc}
2008-02-01 17:36:33 +00:00
|
|
|
}
|
2009-11-22 14:37:05 +00:00
|
|
|
if(!metadataGetMode) {
|
|
|
|
SharedHandle<UnionSeedCriteria> unionCri(new UnionSeedCriteria());
|
|
|
|
if(option->defined(PREF_SEED_TIME)) {
|
|
|
|
SharedHandle<SeedCriteria> cri
|
2010-01-05 16:01:46 +00:00
|
|
|
(new TimeSeedCriteria(option->getAsInt(PREF_SEED_TIME)*60));
|
2008-04-20 00:50:22 +00:00
|
|
|
unionCri->addSeedCriteria(cri);
|
2007-11-21 16:14:40 +00:00
|
|
|
}
|
2009-11-22 14:37:05 +00:00
|
|
|
{
|
|
|
|
double ratio = option->getAsDouble(PREF_SEED_RATIO);
|
|
|
|
if(ratio > 0.0) {
|
2010-01-05 16:01:46 +00:00
|
|
|
SharedHandle<ShareRatioSeedCriteria> cri
|
|
|
|
(new ShareRatioSeedCriteria(option->getAsDouble(PREF_SEED_RATIO),
|
|
|
|
requestGroup->getDownloadContext()));
|
|
|
|
cri->setPieceStorage(pieceStorage);
|
|
|
|
cri->setPeerStorage(peerStorage);
|
2007-10-11 16:58:24 +00:00
|
|
|
|
2010-01-05 16:01:46 +00:00
|
|
|
unionCri->addSeedCriteria(cri);
|
2009-11-22 14:37:05 +00:00
|
|
|
}
|
|
|
|
}
|
2010-03-30 13:08:10 +00:00
|
|
|
if(!unionCri->getSeedCriterion().empty()) {
|
2009-11-22 14:37:05 +00:00
|
|
|
SeedCheckCommand* c =
|
2010-01-05 16:01:46 +00:00
|
|
|
new SeedCheckCommand(e->newCUID(), requestGroup, e, unionCri);
|
2009-11-22 14:37:05 +00:00
|
|
|
c->setPieceStorage(pieceStorage);
|
|
|
|
c->setBtRuntime(btRuntime);
|
|
|
|
commands.push_back(c);
|
|
|
|
}
|
|
|
|
}
|
2011-07-21 14:42:41 +00:00
|
|
|
if(btReg->getTcpPort() == 0) {
|
2010-08-14 06:52:35 +00:00
|
|
|
static int families[] = { AF_INET, AF_INET6 };
|
2010-08-27 11:48:09 +00:00
|
|
|
size_t familiesLength = e->getOption()->getAsBool(PREF_DISABLE_IPV6)?1:2;
|
|
|
|
for(size_t i = 0; i < familiesLength; ++i) {
|
2011-07-21 14:42:41 +00:00
|
|
|
PeerListenCommand* command =
|
|
|
|
new PeerListenCommand(e->newCUID(), e, families[i]);
|
2010-08-14 06:52:35 +00:00
|
|
|
bool ret;
|
|
|
|
uint16_t port;
|
2011-07-21 14:42:41 +00:00
|
|
|
if(btReg->getTcpPort()) {
|
|
|
|
IntSequence seq = util::parseIntRange(util::uitos(btReg->getTcpPort()));
|
|
|
|
ret = command->bindPort(port, seq);
|
2010-08-14 06:52:35 +00:00
|
|
|
} else {
|
|
|
|
IntSequence seq =
|
|
|
|
util::parseIntRange(e->getOption()->get(PREF_LISTEN_PORT));
|
2011-07-21 14:42:41 +00:00
|
|
|
ret = command->bindPort(port, seq);
|
2010-08-14 06:52:35 +00:00
|
|
|
}
|
|
|
|
if(ret) {
|
2011-07-21 14:42:41 +00:00
|
|
|
btReg->setTcpPort(port);
|
2010-08-14 06:52:35 +00:00
|
|
|
// Add command to DownloadEngine directly.
|
2011-07-21 14:42:41 +00:00
|
|
|
e->addCommand(command);
|
2010-08-14 06:52:35 +00:00
|
|
|
} else {
|
2011-07-21 14:42:41 +00:00
|
|
|
delete command;
|
2010-08-14 06:52:35 +00:00
|
|
|
}
|
|
|
|
}
|
2011-07-21 14:42:41 +00:00
|
|
|
if(btReg->getTcpPort() == 0) {
|
2009-10-31 09:53:23 +00:00
|
|
|
throw DL_ABORT_EX(_("Errors occurred while binding port.\n"));
|
2007-11-04 12:26:12 +00:00
|
|
|
}
|
|
|
|
}
|
2011-07-21 14:42:41 +00:00
|
|
|
btAnnounce->setTcpPort(btReg->getTcpPort());
|
|
|
|
|
2010-02-20 14:23:25 +00:00
|
|
|
if(option->getAsBool(PREF_BT_ENABLE_LPD) &&
|
2011-07-21 14:42:41 +00:00
|
|
|
btReg->getTcpPort() &&
|
2010-06-18 14:47:09 +00:00
|
|
|
(metadataGetMode || !torrentAttrs->privateTorrent)) {
|
2011-07-21 15:41:45 +00:00
|
|
|
if(!btReg->getLpdMessageReceiver()) {
|
2010-11-20 08:21:36 +00:00
|
|
|
A2_LOG_INFO("Initializing LpdMessageReceiver.");
|
2010-02-20 14:23:25 +00:00
|
|
|
SharedHandle<LpdMessageReceiver> receiver
|
|
|
|
(new LpdMessageReceiver(LPD_MULTICAST_ADDR, LPD_MULTICAST_PORT));
|
2010-02-22 15:58:05 +00:00
|
|
|
bool initialized = false;
|
2010-06-08 14:11:36 +00:00
|
|
|
const std::string& lpdInterface =
|
|
|
|
e->getOption()->get(PREF_BT_LPD_INTERFACE);
|
2010-02-22 15:58:05 +00:00
|
|
|
if(lpdInterface.empty()) {
|
|
|
|
if(receiver->init("")) {
|
|
|
|
initialized = true;
|
|
|
|
}
|
|
|
|
} else {
|
2011-10-19 15:06:44 +00:00
|
|
|
std::vector<std::pair<sockaddr_union, socklen_t> > ifAddrs;
|
2010-02-23 13:50:35 +00:00
|
|
|
getInterfaceAddress(ifAddrs, lpdInterface, AF_INET, AI_NUMERICHOST);
|
2011-10-19 15:06:44 +00:00
|
|
|
for(std::vector<std::pair<sockaddr_union, socklen_t> >::const_iterator
|
2010-02-28 16:04:52 +00:00
|
|
|
i = ifAddrs.begin(), eoi = ifAddrs.end(); i != eoi; ++i) {
|
2011-08-20 12:53:48 +00:00
|
|
|
char host[NI_MAXHOST];
|
2011-10-19 15:06:44 +00:00
|
|
|
if(inetNtop(AF_INET, &(*i).first.in, host, sizeof(host)) == 0 &&
|
2011-08-20 12:53:48 +00:00
|
|
|
receiver->init(host)) {
|
2010-02-22 15:58:05 +00:00
|
|
|
initialized = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2010-02-20 14:23:25 +00:00
|
|
|
}
|
2010-02-22 15:58:05 +00:00
|
|
|
if(initialized) {
|
2011-07-21 15:41:45 +00:00
|
|
|
btReg->setLpdMessageReceiver(receiver);
|
2010-11-20 08:21:36 +00:00
|
|
|
A2_LOG_INFO(fmt("LpdMessageReceiver initialized. multicastAddr=%s:%u,"
|
|
|
|
" localAddr=%s",
|
|
|
|
LPD_MULTICAST_ADDR, LPD_MULTICAST_PORT,
|
|
|
|
receiver->getLocalAddress().c_str()));
|
2010-02-20 14:23:25 +00:00
|
|
|
LpdReceiveMessageCommand* cmd =
|
2011-07-21 15:41:45 +00:00
|
|
|
new LpdReceiveMessageCommand(e->newCUID(), receiver, e);
|
2010-06-08 14:11:36 +00:00
|
|
|
e->addCommand(cmd);
|
2010-02-22 15:58:05 +00:00
|
|
|
} else {
|
2010-11-20 08:21:36 +00:00
|
|
|
A2_LOG_INFO("LpdMessageReceiver not initialized.");
|
2010-02-20 14:23:25 +00:00
|
|
|
}
|
|
|
|
}
|
2011-07-21 15:41:45 +00:00
|
|
|
if(btReg->getLpdMessageReceiver()) {
|
2010-02-20 14:23:25 +00:00
|
|
|
const unsigned char* infoHash =
|
|
|
|
bittorrent::getInfoHash(requestGroup->getDownloadContext());
|
2010-11-20 08:21:36 +00:00
|
|
|
A2_LOG_INFO("Initializing LpdMessageDispatcher.");
|
2010-02-20 14:23:25 +00:00
|
|
|
SharedHandle<LpdMessageDispatcher> dispatcher
|
|
|
|
(new LpdMessageDispatcher
|
|
|
|
(std::string(&infoHash[0], &infoHash[INFO_HASH_LENGTH]),
|
2011-07-21 14:42:41 +00:00
|
|
|
btReg->getTcpPort(),
|
2010-02-22 15:58:05 +00:00
|
|
|
LPD_MULTICAST_ADDR, LPD_MULTICAST_PORT));
|
2011-07-21 15:41:45 +00:00
|
|
|
if(dispatcher->init(btReg->getLpdMessageReceiver()->getLocalAddress(),
|
|
|
|
/*ttl*/1, /*loop*/0)) {
|
|
|
|
A2_LOG_INFO("LpdMessageDispatcher initialized.");
|
2010-02-22 15:58:05 +00:00
|
|
|
LpdDispatchMessageCommand* cmd =
|
|
|
|
new LpdDispatchMessageCommand(e->newCUID(), dispatcher, e);
|
|
|
|
cmd->setBtRuntime(btRuntime);
|
2010-06-08 14:11:36 +00:00
|
|
|
e->addCommand(cmd);
|
2010-02-22 15:58:05 +00:00
|
|
|
} else {
|
2010-11-20 08:21:36 +00:00
|
|
|
A2_LOG_INFO("LpdMessageDispatcher not initialized.");
|
2010-02-22 15:58:05 +00:00
|
|
|
}
|
2010-02-20 14:23:25 +00:00
|
|
|
}
|
|
|
|
}
|
2009-07-05 03:11:51 +00:00
|
|
|
time_t btStopTimeout = option->getAsInt(PREF_BT_STOP_TIMEOUT);
|
|
|
|
if(btStopTimeout > 0) {
|
|
|
|
BtStopDownloadCommand* stopDownloadCommand =
|
|
|
|
new BtStopDownloadCommand(e->newCUID(), requestGroup, e, btStopTimeout);
|
|
|
|
stopDownloadCommand->setBtRuntime(btRuntime);
|
|
|
|
stopDownloadCommand->setPieceStorage(pieceStorage);
|
|
|
|
commands.push_back(stopDownloadCommand);
|
|
|
|
}
|
2008-11-03 06:49:02 +00:00
|
|
|
btRuntime->setReady(true);
|
2007-10-11 16:58:24 +00:00
|
|
|
}
|
2008-02-08 15:53:45 +00:00
|
|
|
|
|
|
|
} // namespace aria2
|