2007-11-08 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>

Changed CheckIntegrityEntry interface so that it can define
	the action when all the chunk checksums are valid.
	* src/CheckIntegrityEntry.h
	* src/StreamCheckIntegrityEntry.{h, cc}
	* src/BtCheckIntegrityEntry.{h, cc}: Currently,when all the 
checksums
	are valid, then aira2 goes to seeding mode. Sometimes it is 
better
	to exit rather than doing seeding. So, it would be good to 
toggle this
	behavior.
	* src/CheckIntegrityCommand.cc
	* src/AbstractCommand.cc
	* src/RequestGroup.cc
pull/1/head
Tatsuhiro Tsujikawa 2007-11-08 10:59:44 +00:00
parent b4f7588ba2
commit 76b9093d09
10 changed files with 46 additions and 10 deletions

View File

@ -1,3 +1,17 @@
2007-11-08 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Changed CheckIntegrityEntry interface so that it can define
the action when all the chunk checksums are valid.
* src/CheckIntegrityEntry.h
* src/StreamCheckIntegrityEntry.{h, cc}
* src/BtCheckIntegrityEntry.{h, cc}: Currently,when all the checksums
are valid, then aira2 goes to seeding mode. Sometimes it is better
to exit rather than doing seeding. So, it would be good to toggle this
behavior.
* src/CheckIntegrityCommand.cc
* src/AbstractCommand.cc
* src/RequestGroup.cc
2007-11-07 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Reflect the download length of in-flight pieces.

5
TODO
View File

@ -47,10 +47,11 @@
* Limit the number of opening file to,say,100 in MultiDiskAdaptor.
* Implement the feature to treat http/ftp as auxuality download method for BitTorrent
* http-seeding(single and multi-file torrent)
* Use content-type for PostDownloadHandler
-- remaining features to be implemented for 0.12.0 release
* Reimplement ChecksumCommand(validation using 1 checksum for 1 file)
* Implement duplicate download checking in Bt
* improve --metalink-location field
* Use content-type for PostDownloadHandler
* Do not connect a server when before checking file integrity.
* If size and filename is provided(for example, metalink), "HEAD" like behavior is unnecessary.

View File

@ -425,6 +425,6 @@ void AbstractCommand::prepareForNextAction(Command* nextCommand)
} else
#endif // ENABLE_MESSAGE_DIGEST
{
e->addCommand(entry->prepareForNextAction(e));
e->addCommand(entry->onDownloadIncomplete(e));
}
}

View File

@ -47,7 +47,7 @@ BtCheckIntegrityEntry::BtCheckIntegrityEntry(RequestGroup* requestGroup):
BtCheckIntegrityEntry::~BtCheckIntegrityEntry() {}
Commands BtCheckIntegrityEntry::prepareForNextAction(DownloadEngine* e)
Commands BtCheckIntegrityEntry::onDownloadIncomplete(DownloadEngine* e)
{
Commands commands;
FileAllocationEntryHandle entry = new BtFileAllocationEntry(_requestGroup);
@ -58,3 +58,12 @@ Commands BtCheckIntegrityEntry::prepareForNextAction(DownloadEngine* e)
}
return commands;
}
Commands BtCheckIntegrityEntry::onDownloadFinished(DownloadEngine* e)
{
// TODO Currently,when all the checksums
// are valid, then aira2 goes to seeding mode. Sometimes it is better
// to exit rather than doing seeding. So, it would be good to toggle this
// behavior.
return onDownloadIncomplete(e);
}

View File

@ -43,7 +43,9 @@ public:
virtual ~BtCheckIntegrityEntry();
virtual Commands prepareForNextAction(DownloadEngine* e);
virtual Commands onDownloadFinished(DownloadEngine* e);
virtual Commands onDownloadIncomplete(DownloadEngine* e);
};
typedef SharedHandle<BtCheckIntegrityEntry> BtCheckIntegrityEntryHandle;

View File

@ -65,8 +65,9 @@ bool CheckIntegrityCommand::executeInternal()
_entry->updatePieceStorage();
if(_requestGroup->downloadFinished()) {
logger->notice(MSG_DOWNLOAD_ALREADY_COMPLETED, cuid, _requestGroup->getFilePath().c_str());
_e->addCommand(_entry->onDownloadFinished(_e));
} else {
_e->addCommand(_entry->prepareForNextAction(_e));
_e->addCommand(_entry->onDownloadIncomplete(_e));
}
return true;
} else {

View File

@ -66,7 +66,9 @@ public:
void updatePieceStorage();
virtual Commands prepareForNextAction(DownloadEngine* e) = 0;
virtual Commands onDownloadFinished(DownloadEngine* e) = 0;
virtual Commands onDownloadIncomplete(DownloadEngine* e) = 0;
};
typedef SharedHandle<CheckIntegrityEntry> CheckIntegrityEntryHandle;

View File

@ -214,7 +214,7 @@ Commands RequestGroup::createInitialCommand(DownloadEngine* e)
} else
#endif // ENABLE_MESSAGE_DIGEST
{
commands = entry->prepareForNextAction(e);
commands = entry->onDownloadIncomplete(e);
}
return commands;
}

View File

@ -51,7 +51,7 @@ StreamCheckIntegrityEntry::StreamCheckIntegrityEntry(const RequestHandle& curren
StreamCheckIntegrityEntry::~StreamCheckIntegrityEntry() {}
Commands StreamCheckIntegrityEntry::prepareForNextAction(DownloadEngine* e)
Commands StreamCheckIntegrityEntry::onDownloadIncomplete(DownloadEngine* e)
{
Commands commands;
if(_requestGroup->needsFileAllocation()) {
@ -73,3 +73,8 @@ Commands StreamCheckIntegrityEntry::prepareForNextAction(DownloadEngine* e)
}
return commands;
}
Commands StreamCheckIntegrityEntry::onDownloadFinished(DownloadEngine* e)
{
return Commands();
}

View File

@ -57,7 +57,9 @@ public:
virtual ~StreamCheckIntegrityEntry();
virtual Commands prepareForNextAction(DownloadEngine* e);
virtual Commands onDownloadFinished(DownloadEngine* e);
virtual Commands onDownloadIncomplete(DownloadEngine* e);
};
typedef SharedHandle<StreamCheckIntegrityEntry> StreamCheckIntegrityEntryHandle;