2009-07-04 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>

Removed unused method argument.
	* src/CreateRequestCommand.cc
	* src/RequestGroup.cc
	* src/RequestGroup.h
	* src/RequestGroupMan.cc
	* src/TrackerWatcherCommand.cc
pull/1/head
Tatsuhiro Tsujikawa 2009-07-04 14:32:53 +00:00
parent a7c222b8ab
commit 3f3e9c0ff0
6 changed files with 27 additions and 30 deletions

View File

@ -1,3 +1,12 @@
2009-07-04 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Removed unused method argument.
* src/CreateRequestCommand.cc
* src/RequestGroup.cc
* src/RequestGroup.h
* src/RequestGroupMan.cc
* src/TrackerWatcherCommand.cc
2009-07-04 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Made URI reusing function work.

View File

@ -75,8 +75,10 @@ bool CreateRequestCommand::executeInternal()
getOption()->get(PREF_REFERER),
// Don't use HEAD request when file
// size is known.
_fileEntry->getLength() == 0 &&
getOption()->getAsBool(PREF_USE_HEAD)?
// Use HEAD for dry-run mode.
(_fileEntry->getLength() == 0 &&
getOption()->getAsBool(PREF_USE_HEAD)) ||
getOption()->getAsBool(PREF_DRY_RUN)?
Request::METHOD_HEAD:Request::METHOD_GET);
if(req.isNull()) {
if(!_requestGroup->getSegmentMan().isNull()) {

View File

@ -196,8 +196,7 @@ void RequestGroup::closeFile()
}
void RequestGroup::createInitialCommand(std::deque<Command*>& commands,
DownloadEngine* e,
const std::string& method)
DownloadEngine* e)
{
#ifdef ENABLE_BITTORRENT
{
@ -351,7 +350,7 @@ void RequestGroup::createInitialCommand(std::deque<Command*>& commands,
// not 0, then filepath is also set DownloadContext correctly....
if(_option->getAsBool(PREF_DRY_RUN) ||
_downloadContext->getTotalLength() == 0) {
createNextCommand(commands, e, 1, method);
createNextCommand(commands, e, 1);
}else {
if(e->_requestGroupMan->isSameFileBeingDownloaded(this)) {
throw DOWNLOAD_FAILURE_EXCEPTION
@ -596,8 +595,7 @@ void RequestGroup::createNextCommandWithAdj(std::deque<Command*>& commands,
void RequestGroup::createNextCommand(std::deque<Command*>& commands,
DownloadEngine* e,
unsigned int numCommand,
const std::string& method)
unsigned int numCommand)
{
// TODO1.5 The following block should be moved into FileEntry
// if(_option->getAsBool(PREF_REUSE_URI) && _uris.empty()) {

View File

@ -183,21 +183,15 @@ public:
// Returns first bootstrap commands to initiate a download.
// If this is HTTP/FTP download and file size is unknown, only 1 command
// (usually, HttpInitiateConnection or FtpInitiateConnection) will be created
// with its Request object having Requet::METHOD_HEAD in its method.
// This behavior can be changed by providing 3rd argument.
// The method has effect only for using HTTP request including FTP via HTTP
// proxy.
// (usually, HttpInitiateConnection or FtpInitiateConnection) will be created.
void createInitialCommand(std::deque<Command*>& commands,
DownloadEngine* e,
const std::string& method = Request::METHOD_HEAD);
DownloadEngine* e);
void createNextCommandWithAdj(std::deque<Command*>& commands,
DownloadEngine* e, int numAdj);
void createNextCommand(std::deque<Command*>& commands,
DownloadEngine* e, unsigned int numCommand,
const std::string& method = Request::METHOD_GET);
DownloadEngine* e, unsigned int numCommand);
bool downloadFinished() const;

View File

@ -428,13 +428,9 @@ void RequestGroupMan::configureRequestGroup
static void createInitialCommand(const SharedHandle<RequestGroup>& requestGroup,
std::deque<Command*>& commands,
DownloadEngine* e,
bool useHead)
DownloadEngine* e)
{
requestGroup->createInitialCommand(commands, e,
useHead ?
Request::METHOD_HEAD :
Request::METHOD_GET);
requestGroup->createInitialCommand(commands, e);
}
void RequestGroupMan::fillRequestGroupFromReserver(DownloadEngine* e)
@ -456,9 +452,7 @@ void RequestGroupMan::fillRequestGroupFromReserver(DownloadEngine* e)
}
configureRequestGroup(groupToAdd);
Commands commands;
createInitialCommand(groupToAdd, commands, e,
_option->getAsBool(PREF_USE_HEAD)||
_option->getAsBool(PREF_DRY_RUN));
createInitialCommand(groupToAdd, commands, e);
_requestGroups.push_back(groupToAdd);
++count;
e->addCommand(commands);
@ -486,9 +480,7 @@ void RequestGroupMan::getInitialCommands(std::deque<Command*>& commands,
try {
if((*itr)->isDependencyResolved()) {
configureRequestGroup(*itr);
createInitialCommand(*itr, commands, e,
// TODO1.5 We need PREF_DRY_RUN here?
_option->getAsBool(PREF_USE_HEAD));
createInitialCommand(*itr, commands, e);
executeStartHook(*itr, e->option);
++itr;
} else {

View File

@ -96,8 +96,7 @@ bool TrackerWatcherCommand::execute() {
_trackerRequestGroup = createAnnounce();
if(!_trackerRequestGroup.isNull()) {
std::deque<Command*> commands;
_trackerRequestGroup->createInitialCommand(commands, e,
Request::METHOD_GET);
_trackerRequestGroup->createInitialCommand(commands, e);
e->addCommand(commands);
logger->debug("added tracker request command");
}
@ -210,6 +209,9 @@ TrackerWatcherCommand::createRequestGroup(const std::string& uri)
logger->debug("This is single-tracker announce.");
rg->getOption()->put(PREF_MAX_TRIES, "5");
}
// TODO When dry-run mode becomes available in BitTorrent, set
// PREF_DRY_RUN=false too.
rg->getOption()->put(PREF_USE_HEAD, V_FALSE);
static const std::string TRACKER_ANNOUNCE_FILE("[tracker.announce]");
SharedHandle<DownloadContext> dctx