mirror of https://github.com/aria2/aria2
2008-11-14 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Print "[MEMORY]" and filename if a file is not saved in disk and just processed in memory. This is the fix for previous comment out. * src/MemoryBufferPreDownloadHandler.cc * src/RequestGroup.cc * src/RequestGroup.hpull/1/head
parent
6c397fe7ba
commit
690340ef02
|
@ -1,3 +1,11 @@
|
|||
2008-11-14 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||
|
||||
Print "[MEMORY]" and filename if a file is not saved in disk and just
|
||||
processed in memory. This is the fix for previous comment out.
|
||||
* src/MemoryBufferPreDownloadHandler.cc
|
||||
* src/RequestGroup.cc
|
||||
* src/RequestGroup.h
|
||||
|
||||
2008-11-14 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||
|
||||
Commented out the code which sets virtual directory path "[MEMORY]"
|
||||
|
|
|
@ -49,10 +49,7 @@ void MemoryBufferPreDownloadHandler::execute(RequestGroup* requestGroup)
|
|||
requestGroup->setDiskWriterFactory(dwf);
|
||||
requestGroup->setFileAllocationEnabled(false);
|
||||
requestGroup->setPreLocalFileCheckEnabled(false);
|
||||
|
||||
// TODO to propage direction to save, comment out following 2 lines.
|
||||
//static const std::string DIR_MEMORY("[MEMORY]");
|
||||
//requestGroup->getDownloadContext()->setDir(DIR_MEMORY);
|
||||
requestGroup->markInMemoryDownload();
|
||||
}
|
||||
|
||||
} // namespace aria2
|
||||
|
|
|
@ -125,6 +125,7 @@ RequestGroup::RequestGroup(const Option* option,
|
|||
_uriSelector(new InOrderURISelector()),
|
||||
_lastModifiedTime(Time::null()),
|
||||
_fileNotFoundCount(0),
|
||||
_inMemoryDownload(false),
|
||||
_option(option),
|
||||
_logger(LogFactory::getInstance())
|
||||
{
|
||||
|
@ -892,10 +893,18 @@ DownloadResultHandle RequestGroup::createDownloadResult() const
|
|||
_segmentMan->calculateSessionDownloadLength();
|
||||
}
|
||||
|
||||
std::string path;
|
||||
if(inMemoryDownload()) {
|
||||
static const std::string DIR_MEMORY("[MEMORY]");
|
||||
path = DIR_MEMORY+File(getFilePath()).getBasename();
|
||||
} else {
|
||||
path = getFilePath();
|
||||
}
|
||||
|
||||
return
|
||||
SharedHandle<DownloadResult>
|
||||
(new DownloadResult(_gid,
|
||||
getFilePath(),
|
||||
path,
|
||||
getTotalLength(),
|
||||
uris.empty() ? A2STR::NIL:uris.front(),
|
||||
uris.size(),
|
||||
|
@ -1080,4 +1089,14 @@ unsigned int RequestGroup::getNumConcurrentCommand() const
|
|||
return _numConcurrentCommand;
|
||||
}
|
||||
|
||||
void RequestGroup::markInMemoryDownload()
|
||||
{
|
||||
_inMemoryDownload = true;
|
||||
}
|
||||
|
||||
bool RequestGroup::inMemoryDownload() const
|
||||
{
|
||||
return _inMemoryDownload;
|
||||
}
|
||||
|
||||
} // namespace aria2
|
||||
|
|
|
@ -132,6 +132,10 @@ private:
|
|||
WeakHandle<PeerStorage> _peerStorage;
|
||||
#endif // ENABLE_BITTORRENT
|
||||
|
||||
// This flag just indicates that the downloaded file is not saved disk but
|
||||
// just sits in memory.
|
||||
bool _inMemoryDownload;
|
||||
|
||||
const Option* _option;
|
||||
|
||||
Logger* _logger;
|
||||
|
@ -386,6 +390,12 @@ public:
|
|||
void updateLastModifiedTime(const Time& time);
|
||||
|
||||
void increaseAndValidateFileNotFoundCount();
|
||||
|
||||
// Just set inMemoryDownload flag true.
|
||||
void markInMemoryDownload();
|
||||
|
||||
// Returns inMemoryDownload flag.
|
||||
bool inMemoryDownload() const;
|
||||
};
|
||||
|
||||
typedef SharedHandle<RequestGroup> RequestGroupHandle;
|
||||
|
|
Loading…
Reference in New Issue