2007-12-27 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>

Remove a defunct control file. A defunct control file means that 
while
	it exists, but the corresponding download file is missing.
	After its removal, a download restarts from the beginning.
	* src/RequestGroup.cc
	* src/message.h
pull/1/head
Tatsuhiro Tsujikawa 2007-12-26 15:11:42 +00:00
parent e39f7a7e9c
commit 16722b559d
3 changed files with 23 additions and 0 deletions

View File

@ -1,3 +1,11 @@
2007-12-27 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Remove a defunct control file. A defunct control file means that while
it exists, but the corresponding download file is missing.
After its removal, a download restarts from the beginning.
* src/RequestGroup.cc
* src/message.h
2007-12-26 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Allocate bitfield in Peer when it is really used. More specifically,

View File

@ -192,6 +192,13 @@ Commands RequestGroup::createInitialCommand(DownloadEngine* e)
BtRegistry::registerPeerObjectCluster(btContext->getInfoHashAsString(),
new PeerObjectCluster());
// Remove the control file if download file doesn't exist
if(progressInfoFile->exists() && !_pieceStorage->getDiskAdaptor()->fileExists()) {
progressInfoFile->removeFile();
_logger->notice(MSG_REMOVED_DEFUNCT_CONTROL_FILE,
progressInfoFile->getFilename().c_str(),
_pieceStorage->getDiskAdaptor()->getFilePath().c_str());
}
// Call Load, Save and file allocation command here
if(progressInfoFile->exists()) {
// load .aria2 file if it exists.
@ -302,6 +309,13 @@ void RequestGroup::loadAndOpenFile(const BtProgressInfoFileHandle& progressInfoF
_pieceStorage->getDiskAdaptor()->initAndOpenFile();
return;
}
// Remove the control file if download file doesn't exist
if(progressInfoFile->exists() && !_pieceStorage->getDiskAdaptor()->fileExists()) {
progressInfoFile->removeFile();
_logger->notice(MSG_REMOVED_DEFUNCT_CONTROL_FILE,
progressInfoFile->getFilename().c_str(),
_pieceStorage->getDiskAdaptor()->getFilePath().c_str());
}
if(progressInfoFile->exists()) {
progressInfoFile->load();
_pieceStorage->getDiskAdaptor()->openExistingFile();

View File

@ -133,6 +133,7 @@
#define MSG_FILE_RENAMED _("File already exists. Renamed to %s.")
#define MSG_CANNOT_PARSE_METALINK _("Cannot parse metalink XML file. XML may be malformed.")
#define MSG_TOO_SMALL_PAYLOAD_SIZE _("Too small payload size for %s, size=%d.")
#define MSG_REMOVED_DEFUNCT_CONTROL_FILE _("Removed the defunct control file %s because the download file %s doesn't exist.")
#define EX_TIME_OUT _("Timeout.")
#define EX_INVALID_CHUNK_SIZE _("Invalid chunk size.")