2007-05-20 13:57:56 +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
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*
|
|
|
|
* 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 --> */
|
|
|
|
#ifndef _D_REQUEST_GROUP_H_
|
|
|
|
#define _D_REQUEST_GROUP_H_
|
|
|
|
|
|
|
|
#include "common.h"
|
2007-10-11 16:58:24 +00:00
|
|
|
#include "TransferStat.h"
|
2007-05-31 15:56:20 +00:00
|
|
|
|
2007-05-20 13:57:56 +00:00
|
|
|
class DownloadEngine;
|
2007-10-11 16:58:24 +00:00
|
|
|
class SegmentMan;
|
2007-11-23 08:47:38 +00:00
|
|
|
typedef SharedHandle<SegmentMan> SegmentManHandle;
|
2007-10-11 16:58:24 +00:00
|
|
|
class SegmentManFactory;
|
2007-11-23 08:47:38 +00:00
|
|
|
typedef SharedHandle<SegmentManFactory> SegmentManFactoryHandle;
|
2007-10-11 16:58:24 +00:00
|
|
|
class Command;
|
2007-11-23 08:47:38 +00:00
|
|
|
typedef deque<Command*> Commands;
|
2007-10-11 16:58:24 +00:00
|
|
|
class DownloadContext;
|
2007-11-23 08:47:38 +00:00
|
|
|
typedef SharedHandle<DownloadContext> DownloadContextHandle;
|
2007-10-11 16:58:24 +00:00
|
|
|
class PieceStorage;
|
2007-11-23 08:47:38 +00:00
|
|
|
typedef SharedHandle<PieceStorage> PieceStorageHandle;
|
2007-10-11 16:58:24 +00:00
|
|
|
class BtProgressInfoFile;
|
2007-11-23 08:47:38 +00:00
|
|
|
typedef SharedHandle<BtProgressInfoFile> BtProgressInfoFileHandle;
|
2007-10-11 16:58:24 +00:00
|
|
|
class Dependency;
|
2007-11-23 08:47:38 +00:00
|
|
|
typedef SharedHandle<Dependency> DependencyHandle;
|
2007-10-11 16:58:24 +00:00
|
|
|
class DlAbortEx;
|
2007-11-27 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Rewritten to add content-type support.
* src/DownloadHandler.{h, cc}
* src/BtPostDownloadHandler.{h, cc}
* test/BtPostDownloadHandlerTest.cc
* src/MetalinkPostDownloadHandler.{h, cc}
* test/MetalinkPostDownloadHandlerTest.cc
* src/PostDownloadHandler.{h, cc}
* src/DownloadHandlerConstants.{h, cc}
* src/RequestGroup.cc
* src/HttpResponseCommand.cc
* src/FtpNegotiationCommand.cc
* src/SingleFileDownloadContext.{h, cc}
* src/RequestGroup.h
* src/RequestGroupCriteria.h
* src/ContentTypeRequestGroupCriteria.h
Added 'mem' option value for --follow-metalink,
--follow-torrent.
If it is give, metalink/torrent file is not written to the disk,
but
just is kept in memory. Parsing is occurred on memory.
* src/MetalinkHelper.{h, cc}
* src/MetalinkProcessor.h
* src/Xml2MetalinkProcessor.{h, cc}
* test/Xml2MetalinkProcessorTest.cc
* src/DownloadHandlerFactory.{h, cc}
* test/DownloadHandlerFactoryTest.cc
* src/PreDownloadHandler.{h, cc}
* src/OptionHandlerFactory.cc
* src/DefaultBtContext.{h, cc}
* test/DefaultBtContextTest.cc
* src/version_usage.cc
* src/Metalink2RequestGroup.{h, cc}
* src/RequestGroup.{h, cc}
* src/a2functional.h
* test/a2functionalTest.cc
* src/MemoryBufferPreDownloadHandler.{h, cc}
* src/OptionHandlerImpl.h
* src/prefs.h
* src/Util.{h, cc}
* test/UtilTest.cc
Keep DownloadResult rather than RequestGroup after downloads to
reduce
memory usage.
* src/RequestGroupMan.{h, cc}
* src/DownloadEngine.cc
* src/BtDependency.{h, cc}: Changed the type of dependee from
WeakHandle to SharedHandle because WeakHandle could be null.
* src/RequestGroup.{h, cc}
* src/DownloadEngineFactory.cc
* src/DownloadResult.h
Set totalLength after download finished
* src/UnknownLengthPieceStorage.{h, cc}
Keep torrent file specified in metalink in memory.
* src/Metalink2RequestGroup.cc
* src/BtDependency.cc
* src/TrueRequestGroupCriteria.h
Fixed the bug: seekg is used where seekp should be used.
* src/ByteArrayDiskWriter.cc
* test/ByteArraydiskWriterTest.cc
2007-11-27 12:27:10 +00:00
|
|
|
class PreDownloadHandler;
|
|
|
|
typedef SharedHandle<PreDownloadHandler> PreDownloadHandlerHandle;
|
|
|
|
typedef deque<PreDownloadHandlerHandle> PreDownloadHandlers;
|
2007-10-11 16:58:24 +00:00
|
|
|
class PostDownloadHandler;
|
2007-11-23 08:47:38 +00:00
|
|
|
typedef SharedHandle<PostDownloadHandler> PostDownloadHandlerHandle;
|
|
|
|
typedef deque<PostDownloadHandlerHandle> PostDownloadHandlers;
|
2007-10-11 16:58:24 +00:00
|
|
|
class DiskWriterFactory;
|
2007-11-23 08:47:38 +00:00
|
|
|
typedef SharedHandle<DiskWriterFactory> DiskWriterFactoryHandle;
|
2007-10-11 16:58:24 +00:00
|
|
|
class Option;
|
|
|
|
class Logger;
|
|
|
|
class RequestGroup;
|
2007-11-23 08:47:38 +00:00
|
|
|
typedef SharedHandle<RequestGroup> RequestGroupHandle;
|
|
|
|
typedef deque<RequestGroupHandle> RequestGroups;
|
2007-11-10 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Don't connect server before checking file integrity at startup,
if
filesize and output file path are known.
* src/AbstractCommand.cc
* src/StreamFileAllocationEntry.cc
* src/Metalink2RequestGroup.cc
* src/RequestGroup.{h, cc}
* src/HttpResponseCommand.cc
* src/FtpNegotiationCommand.cc
Added DownloadFailureException. If it is thrown, RequestGroup
should
halt.
* src/AbstractCommand.cc
* src/DownloadFailureException.h
* src/RequestGroup.cc
Catch RecoverableException, instead of DlAbortEx.
* src/RequestGroupMan.cc
* src/FillRequestGroupCommand.cc
* src/MetaFileUtil.cc
* src/IteratableChunkChecksumValidator.cc
Now first parameter of MSG_DOWNLOAD_ABORTED is
gid(RequestGroup::
getGID())
* src/CheckIntegrityCommand.cc
* src/message.h
Print gid instead of idx.
* src/RequestGroupMan.cc
Removed exception throwers declaration.
* src/DirectDiskAdaptor.{h, cc}
* src/SocketCore.{h, cc}
* src/MultiDiskAdaptor.{h, cc}
* src/HttpConnection.{h, cc}
* src/HttpResponse.{h, cc}
* src/DiskAdaptor.{h, cc}
* src/CopyDiskAdaptor.{h, cc}
* src/MultiDiskAdaptor.{h, cc}
* src/HttpHeaderProcessor.{h, cc}
* src/AbstractSingleDiskAdaptor.{h, cc}
* src/Util.{h, cc}
* test/UtilTest.cc
* src/DefaultDiskWriter.{h, cc}
* src/FtpConnection.{h, cc}
* src/AbstractDiskWriter.{h, cc}
Removed duplicate code.
* src/StreamCheckIntegrityEntry.cc
Removed unnecessary include.
* src/DiskWriter.h
Included Exception.h
* src/option_processing.cc
Included 2 files and added doc
* src/TrackerWatcherCommand.cc
* src/SocketCore.cc (writeData): Fixed send error with GnuTLS.
2007-11-09 18:01:12 +00:00
|
|
|
class CheckIntegrityEntry;
|
2007-11-23 08:47:38 +00:00
|
|
|
typedef SharedHandle<CheckIntegrityEntry> CheckIntegrityEntryHandle;
|
2007-11-27 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Rewritten to add content-type support.
* src/DownloadHandler.{h, cc}
* src/BtPostDownloadHandler.{h, cc}
* test/BtPostDownloadHandlerTest.cc
* src/MetalinkPostDownloadHandler.{h, cc}
* test/MetalinkPostDownloadHandlerTest.cc
* src/PostDownloadHandler.{h, cc}
* src/DownloadHandlerConstants.{h, cc}
* src/RequestGroup.cc
* src/HttpResponseCommand.cc
* src/FtpNegotiationCommand.cc
* src/SingleFileDownloadContext.{h, cc}
* src/RequestGroup.h
* src/RequestGroupCriteria.h
* src/ContentTypeRequestGroupCriteria.h
Added 'mem' option value for --follow-metalink,
--follow-torrent.
If it is give, metalink/torrent file is not written to the disk,
but
just is kept in memory. Parsing is occurred on memory.
* src/MetalinkHelper.{h, cc}
* src/MetalinkProcessor.h
* src/Xml2MetalinkProcessor.{h, cc}
* test/Xml2MetalinkProcessorTest.cc
* src/DownloadHandlerFactory.{h, cc}
* test/DownloadHandlerFactoryTest.cc
* src/PreDownloadHandler.{h, cc}
* src/OptionHandlerFactory.cc
* src/DefaultBtContext.{h, cc}
* test/DefaultBtContextTest.cc
* src/version_usage.cc
* src/Metalink2RequestGroup.{h, cc}
* src/RequestGroup.{h, cc}
* src/a2functional.h
* test/a2functionalTest.cc
* src/MemoryBufferPreDownloadHandler.{h, cc}
* src/OptionHandlerImpl.h
* src/prefs.h
* src/Util.{h, cc}
* test/UtilTest.cc
Keep DownloadResult rather than RequestGroup after downloads to
reduce
memory usage.
* src/RequestGroupMan.{h, cc}
* src/DownloadEngine.cc
* src/BtDependency.{h, cc}: Changed the type of dependee from
WeakHandle to SharedHandle because WeakHandle could be null.
* src/RequestGroup.{h, cc}
* src/DownloadEngineFactory.cc
* src/DownloadResult.h
Set totalLength after download finished
* src/UnknownLengthPieceStorage.{h, cc}
Keep torrent file specified in metalink in memory.
* src/Metalink2RequestGroup.cc
* src/BtDependency.cc
* src/TrueRequestGroupCriteria.h
Fixed the bug: seekg is used where seekp should be used.
* src/ByteArrayDiskWriter.cc
* test/ByteArraydiskWriterTest.cc
2007-11-27 12:27:10 +00:00
|
|
|
class DownloadResult;
|
|
|
|
typedef SharedHandle<DownloadResult> DownloadResultHandle;
|
2007-05-20 13:57:56 +00:00
|
|
|
|
|
|
|
class RequestGroup {
|
|
|
|
private:
|
2007-10-11 16:58:24 +00:00
|
|
|
static int32_t _gidCounter;
|
|
|
|
|
2007-06-10 15:22:36 +00:00
|
|
|
int32_t _gid;
|
2007-10-11 16:58:24 +00:00
|
|
|
|
2007-05-20 13:57:56 +00:00
|
|
|
Strings _uris;
|
|
|
|
Strings _spentUris;
|
2007-10-11 16:58:24 +00:00
|
|
|
|
|
|
|
int32_t _numConcurrentCommand;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This is the number of connections used in streaming protocol(http/ftp)
|
|
|
|
*/
|
|
|
|
int32_t _numStreamConnection;
|
|
|
|
|
|
|
|
int32_t _numCommand;
|
|
|
|
|
2007-05-20 13:57:56 +00:00
|
|
|
SegmentManHandle _segmentMan;
|
|
|
|
SegmentManFactoryHandle _segmentManFactory;
|
2007-10-11 16:58:24 +00:00
|
|
|
|
|
|
|
DownloadContextHandle _downloadContext;
|
|
|
|
|
|
|
|
PieceStorageHandle _pieceStorage;
|
|
|
|
|
|
|
|
BtProgressInfoFileHandle _progressInfoFile;
|
|
|
|
|
|
|
|
DiskWriterFactoryHandle _diskWriterFactory;
|
|
|
|
|
|
|
|
DependencyHandle _dependency;
|
|
|
|
|
|
|
|
bool _fileAllocationEnabled;
|
|
|
|
|
|
|
|
bool _preLocalFileCheckEnabled;
|
|
|
|
|
|
|
|
bool _haltRequested;
|
|
|
|
|
2007-12-07 13:33:59 +00:00
|
|
|
bool _forceHaltRequested;
|
|
|
|
|
2007-11-27 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Rewritten to add content-type support.
* src/DownloadHandler.{h, cc}
* src/BtPostDownloadHandler.{h, cc}
* test/BtPostDownloadHandlerTest.cc
* src/MetalinkPostDownloadHandler.{h, cc}
* test/MetalinkPostDownloadHandlerTest.cc
* src/PostDownloadHandler.{h, cc}
* src/DownloadHandlerConstants.{h, cc}
* src/RequestGroup.cc
* src/HttpResponseCommand.cc
* src/FtpNegotiationCommand.cc
* src/SingleFileDownloadContext.{h, cc}
* src/RequestGroup.h
* src/RequestGroupCriteria.h
* src/ContentTypeRequestGroupCriteria.h
Added 'mem' option value for --follow-metalink,
--follow-torrent.
If it is give, metalink/torrent file is not written to the disk,
but
just is kept in memory. Parsing is occurred on memory.
* src/MetalinkHelper.{h, cc}
* src/MetalinkProcessor.h
* src/Xml2MetalinkProcessor.{h, cc}
* test/Xml2MetalinkProcessorTest.cc
* src/DownloadHandlerFactory.{h, cc}
* test/DownloadHandlerFactoryTest.cc
* src/PreDownloadHandler.{h, cc}
* src/OptionHandlerFactory.cc
* src/DefaultBtContext.{h, cc}
* test/DefaultBtContextTest.cc
* src/version_usage.cc
* src/Metalink2RequestGroup.{h, cc}
* src/RequestGroup.{h, cc}
* src/a2functional.h
* test/a2functionalTest.cc
* src/MemoryBufferPreDownloadHandler.{h, cc}
* src/OptionHandlerImpl.h
* src/prefs.h
* src/Util.{h, cc}
* test/UtilTest.cc
Keep DownloadResult rather than RequestGroup after downloads to
reduce
memory usage.
* src/RequestGroupMan.{h, cc}
* src/DownloadEngine.cc
* src/BtDependency.{h, cc}: Changed the type of dependee from
WeakHandle to SharedHandle because WeakHandle could be null.
* src/RequestGroup.{h, cc}
* src/DownloadEngineFactory.cc
* src/DownloadResult.h
Set totalLength after download finished
* src/UnknownLengthPieceStorage.{h, cc}
Keep torrent file specified in metalink in memory.
* src/Metalink2RequestGroup.cc
* src/BtDependency.cc
* src/TrueRequestGroupCriteria.h
Fixed the bug: seekg is used where seekp should be used.
* src/ByteArrayDiskWriter.cc
* test/ByteArraydiskWriterTest.cc
2007-11-27 12:27:10 +00:00
|
|
|
PreDownloadHandlers _preDownloadHandlers;
|
|
|
|
|
2007-10-11 16:58:24 +00:00
|
|
|
PostDownloadHandlers _postDownloadHandlers;
|
|
|
|
|
2007-05-20 13:57:56 +00:00
|
|
|
const Option* _option;
|
2007-10-11 16:58:24 +00:00
|
|
|
|
|
|
|
const Logger* _logger;
|
2007-05-20 13:57:56 +00:00
|
|
|
|
|
|
|
void validateFilename(const string& expectedFilename,
|
|
|
|
const string& actualFilename) const;
|
|
|
|
|
|
|
|
void validateTotalLength(int64_t expectedTotalLength,
|
|
|
|
int64_t actualTotalLength) const;
|
|
|
|
|
2007-11-27 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Rewritten to add content-type support.
* src/DownloadHandler.{h, cc}
* src/BtPostDownloadHandler.{h, cc}
* test/BtPostDownloadHandlerTest.cc
* src/MetalinkPostDownloadHandler.{h, cc}
* test/MetalinkPostDownloadHandlerTest.cc
* src/PostDownloadHandler.{h, cc}
* src/DownloadHandlerConstants.{h, cc}
* src/RequestGroup.cc
* src/HttpResponseCommand.cc
* src/FtpNegotiationCommand.cc
* src/SingleFileDownloadContext.{h, cc}
* src/RequestGroup.h
* src/RequestGroupCriteria.h
* src/ContentTypeRequestGroupCriteria.h
Added 'mem' option value for --follow-metalink,
--follow-torrent.
If it is give, metalink/torrent file is not written to the disk,
but
just is kept in memory. Parsing is occurred on memory.
* src/MetalinkHelper.{h, cc}
* src/MetalinkProcessor.h
* src/Xml2MetalinkProcessor.{h, cc}
* test/Xml2MetalinkProcessorTest.cc
* src/DownloadHandlerFactory.{h, cc}
* test/DownloadHandlerFactoryTest.cc
* src/PreDownloadHandler.{h, cc}
* src/OptionHandlerFactory.cc
* src/DefaultBtContext.{h, cc}
* test/DefaultBtContextTest.cc
* src/version_usage.cc
* src/Metalink2RequestGroup.{h, cc}
* src/RequestGroup.{h, cc}
* src/a2functional.h
* test/a2functionalTest.cc
* src/MemoryBufferPreDownloadHandler.{h, cc}
* src/OptionHandlerImpl.h
* src/prefs.h
* src/Util.{h, cc}
* test/UtilTest.cc
Keep DownloadResult rather than RequestGroup after downloads to
reduce
memory usage.
* src/RequestGroupMan.{h, cc}
* src/DownloadEngine.cc
* src/BtDependency.{h, cc}: Changed the type of dependee from
WeakHandle to SharedHandle because WeakHandle could be null.
* src/RequestGroup.{h, cc}
* src/DownloadEngineFactory.cc
* src/DownloadResult.h
Set totalLength after download finished
* src/UnknownLengthPieceStorage.{h, cc}
Keep torrent file specified in metalink in memory.
* src/Metalink2RequestGroup.cc
* src/BtDependency.cc
* src/TrueRequestGroupCriteria.h
Fixed the bug: seekg is used where seekp should be used.
* src/ByteArrayDiskWriter.cc
* test/ByteArraydiskWriterTest.cc
2007-11-27 12:27:10 +00:00
|
|
|
void initializePreDownloadHandler();
|
|
|
|
|
2007-10-11 16:58:24 +00:00
|
|
|
void initializePostDownloadHandler();
|
2007-11-10 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Don't connect server before checking file integrity at startup,
if
filesize and output file path are known.
* src/AbstractCommand.cc
* src/StreamFileAllocationEntry.cc
* src/Metalink2RequestGroup.cc
* src/RequestGroup.{h, cc}
* src/HttpResponseCommand.cc
* src/FtpNegotiationCommand.cc
Added DownloadFailureException. If it is thrown, RequestGroup
should
halt.
* src/AbstractCommand.cc
* src/DownloadFailureException.h
* src/RequestGroup.cc
Catch RecoverableException, instead of DlAbortEx.
* src/RequestGroupMan.cc
* src/FillRequestGroupCommand.cc
* src/MetaFileUtil.cc
* src/IteratableChunkChecksumValidator.cc
Now first parameter of MSG_DOWNLOAD_ABORTED is
gid(RequestGroup::
getGID())
* src/CheckIntegrityCommand.cc
* src/message.h
Print gid instead of idx.
* src/RequestGroupMan.cc
Removed exception throwers declaration.
* src/DirectDiskAdaptor.{h, cc}
* src/SocketCore.{h, cc}
* src/MultiDiskAdaptor.{h, cc}
* src/HttpConnection.{h, cc}
* src/HttpResponse.{h, cc}
* src/DiskAdaptor.{h, cc}
* src/CopyDiskAdaptor.{h, cc}
* src/MultiDiskAdaptor.{h, cc}
* src/HttpHeaderProcessor.{h, cc}
* src/AbstractSingleDiskAdaptor.{h, cc}
* src/Util.{h, cc}
* test/UtilTest.cc
* src/DefaultDiskWriter.{h, cc}
* src/FtpConnection.{h, cc}
* src/AbstractDiskWriter.{h, cc}
Removed duplicate code.
* src/StreamCheckIntegrityEntry.cc
Removed unnecessary include.
* src/DiskWriter.h
Included Exception.h
* src/option_processing.cc
Included 2 files and added doc
* src/TrackerWatcherCommand.cc
* src/SocketCore.cc (writeData): Fixed send error with GnuTLS.
2007-11-09 18:01:12 +00:00
|
|
|
|
|
|
|
bool tryAutoFileRenaming();
|
|
|
|
|
2007-05-20 13:57:56 +00:00
|
|
|
public:
|
2007-10-11 16:58:24 +00:00
|
|
|
RequestGroup(const Option* option, const Strings& uris);
|
2007-05-20 13:57:56 +00:00
|
|
|
|
2007-10-11 16:58:24 +00:00
|
|
|
~RequestGroup();
|
2007-05-20 13:57:56 +00:00
|
|
|
/**
|
|
|
|
* Reinitializes SegmentMan based on current property values and
|
|
|
|
* returns new one.
|
|
|
|
*/
|
|
|
|
SegmentManHandle initSegmentMan();
|
|
|
|
|
2007-10-11 16:58:24 +00:00
|
|
|
SegmentManHandle getSegmentMan() const;
|
|
|
|
|
|
|
|
Commands createInitialCommand(DownloadEngine* e);
|
2007-05-20 13:57:56 +00:00
|
|
|
|
2007-06-10 07:55:43 +00:00
|
|
|
Commands createNextCommandWithAdj(DownloadEngine* e, int32_t numAdj);
|
2007-06-03 14:24:37 +00:00
|
|
|
|
|
|
|
Commands createNextCommand(DownloadEngine* e, int32_t numCommand, const string& method = "GET");
|
2007-05-20 13:57:56 +00:00
|
|
|
|
|
|
|
void addURI(const string& uri)
|
|
|
|
{
|
|
|
|
_uris.push_back(uri);
|
|
|
|
}
|
|
|
|
|
2007-10-11 16:58:24 +00:00
|
|
|
bool downloadFinished() const;
|
2007-05-20 13:57:56 +00:00
|
|
|
|
2007-10-29 14:06:59 +00:00
|
|
|
bool allDownloadFinished() const;
|
|
|
|
|
2007-10-11 16:58:24 +00:00
|
|
|
void closeFile();
|
2007-05-20 13:57:56 +00:00
|
|
|
|
|
|
|
string getFilePath() const;
|
|
|
|
|
2007-07-01 10:40:30 +00:00
|
|
|
string getDir() const;
|
|
|
|
|
2007-10-11 16:58:24 +00:00
|
|
|
int64_t getTotalLength() const;
|
2007-05-20 13:57:56 +00:00
|
|
|
|
2007-10-11 16:58:24 +00:00
|
|
|
int64_t getCompletedLength() const;
|
2007-05-20 13:57:56 +00:00
|
|
|
|
|
|
|
const Strings& getRemainingUris() const
|
|
|
|
{
|
|
|
|
return _uris;
|
|
|
|
}
|
|
|
|
|
|
|
|
const Strings& getSpentUris() const
|
|
|
|
{
|
|
|
|
return _spentUris;
|
|
|
|
}
|
|
|
|
|
2007-10-11 16:58:24 +00:00
|
|
|
Strings getUris() const;
|
2007-05-20 13:57:56 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Compares expected filename with specified actualFilename.
|
2007-11-18 11:59:42 +00:00
|
|
|
* The expected filename refers to FileEntry::getBasename() of the first
|
|
|
|
* element of DownloadContext::getFileEntries()
|
2007-05-20 13:57:56 +00:00
|
|
|
*/
|
|
|
|
void validateFilename(const string& actualFilename) const;
|
|
|
|
|
|
|
|
void validateTotalLength(int64_t actualTotalLength) const;
|
|
|
|
|
2007-10-11 16:58:24 +00:00
|
|
|
void setSegmentManFactory(const SegmentManFactoryHandle& segmentManFactory);
|
2007-06-03 14:24:37 +00:00
|
|
|
|
|
|
|
void setNumConcurrentCommand(int32_t num)
|
|
|
|
{
|
|
|
|
_numConcurrentCommand = num;
|
|
|
|
}
|
2007-06-04 12:52:57 +00:00
|
|
|
|
2007-10-11 16:58:24 +00:00
|
|
|
int32_t getGID() const
|
|
|
|
{
|
|
|
|
return _gid;
|
|
|
|
}
|
|
|
|
|
|
|
|
TransferStat calculateStat();
|
|
|
|
|
|
|
|
DownloadContextHandle getDownloadContext() const;
|
|
|
|
|
|
|
|
void setDownloadContext(const DownloadContextHandle& downloadContext);
|
|
|
|
|
|
|
|
PieceStorageHandle getPieceStorage() const;
|
|
|
|
|
|
|
|
void setPieceStorage(const PieceStorageHandle& pieceStorage);
|
|
|
|
|
|
|
|
BtProgressInfoFileHandle getProgressInfoFile() const;
|
|
|
|
|
|
|
|
void setProgressInfoFile(const BtProgressInfoFileHandle& progressInfoFile);
|
|
|
|
|
|
|
|
void increaseStreamConnection();
|
|
|
|
|
|
|
|
void decreaseStreamConnection();
|
|
|
|
|
|
|
|
int32_t getNumConnection() const;
|
|
|
|
|
|
|
|
void increaseNumCommand();
|
|
|
|
|
|
|
|
void decreaseNumCommand();
|
|
|
|
|
|
|
|
int32_t getNumCommand() const
|
|
|
|
{
|
|
|
|
return _numCommand;
|
|
|
|
}
|
|
|
|
|
|
|
|
// TODO is it better to move the following 2 methods to SingleFileDownloadContext?
|
|
|
|
void setDiskWriterFactory(const DiskWriterFactoryHandle& diskWriterFactory);
|
2007-06-10 15:22:36 +00:00
|
|
|
|
2007-10-11 16:58:24 +00:00
|
|
|
DiskWriterFactoryHandle getDiskWriterFactory() const;
|
|
|
|
|
|
|
|
void setFileAllocationEnabled(bool f)
|
2007-06-10 15:22:36 +00:00
|
|
|
{
|
2007-10-11 16:58:24 +00:00
|
|
|
_fileAllocationEnabled = f;
|
2007-06-10 15:22:36 +00:00
|
|
|
}
|
|
|
|
|
2007-10-11 16:58:24 +00:00
|
|
|
bool isFileAllocationEnabled() const
|
2007-06-10 15:22:36 +00:00
|
|
|
{
|
2007-10-11 16:58:24 +00:00
|
|
|
return _fileAllocationEnabled;
|
|
|
|
}
|
|
|
|
|
2007-10-29 12:43:45 +00:00
|
|
|
bool needsFileAllocation() const;
|
|
|
|
|
2007-10-11 16:58:24 +00:00
|
|
|
/**
|
|
|
|
* Setting _preLocalFileCheckEnabled to false, then skip the check to see
|
|
|
|
* if a file is already exists and control file exists etc.
|
|
|
|
* Always open file with DiskAdaptor::initAndOpenFile()
|
|
|
|
*/
|
|
|
|
void setPreLocalFileCheckEnabled(bool f)
|
|
|
|
{
|
|
|
|
_preLocalFileCheckEnabled = f;
|
2007-06-10 15:22:36 +00:00
|
|
|
}
|
2007-06-30 09:52:39 +00:00
|
|
|
|
2007-10-11 16:58:24 +00:00
|
|
|
bool isPreLocalFileCheckEnabled() const
|
2007-06-30 09:52:39 +00:00
|
|
|
{
|
2007-10-11 16:58:24 +00:00
|
|
|
return _preLocalFileCheckEnabled;
|
2007-06-30 09:52:39 +00:00
|
|
|
}
|
2007-07-01 14:19:15 +00:00
|
|
|
|
2007-10-11 16:58:24 +00:00
|
|
|
void setHaltRequested(bool f);
|
|
|
|
|
2007-12-07 13:33:59 +00:00
|
|
|
void setForceHaltRequested(bool f);
|
|
|
|
|
2007-10-11 16:58:24 +00:00
|
|
|
bool isHaltRequested() const
|
2007-07-01 14:19:15 +00:00
|
|
|
{
|
2007-10-11 16:58:24 +00:00
|
|
|
return _haltRequested;
|
2007-07-01 14:19:15 +00:00
|
|
|
}
|
2007-08-28 15:46:49 +00:00
|
|
|
|
2007-12-07 13:33:59 +00:00
|
|
|
bool isForceHaltRequested() const
|
|
|
|
{
|
|
|
|
return _forceHaltRequested;
|
|
|
|
}
|
|
|
|
|
2007-10-11 16:58:24 +00:00
|
|
|
void dependsOn(const DependencyHandle& dep);
|
|
|
|
|
|
|
|
bool isDependencyResolved();
|
|
|
|
|
|
|
|
void releaseRuntimeResource();
|
|
|
|
|
|
|
|
RequestGroups postDownloadProcessing();
|
|
|
|
|
|
|
|
void addPostDownloadHandler(const PostDownloadHandlerHandle& handler);
|
|
|
|
|
|
|
|
void clearPostDowloadHandler();
|
2007-11-10 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Don't connect server before checking file integrity at startup,
if
filesize and output file path are known.
* src/AbstractCommand.cc
* src/StreamFileAllocationEntry.cc
* src/Metalink2RequestGroup.cc
* src/RequestGroup.{h, cc}
* src/HttpResponseCommand.cc
* src/FtpNegotiationCommand.cc
Added DownloadFailureException. If it is thrown, RequestGroup
should
halt.
* src/AbstractCommand.cc
* src/DownloadFailureException.h
* src/RequestGroup.cc
Catch RecoverableException, instead of DlAbortEx.
* src/RequestGroupMan.cc
* src/FillRequestGroupCommand.cc
* src/MetaFileUtil.cc
* src/IteratableChunkChecksumValidator.cc
Now first parameter of MSG_DOWNLOAD_ABORTED is
gid(RequestGroup::
getGID())
* src/CheckIntegrityCommand.cc
* src/message.h
Print gid instead of idx.
* src/RequestGroupMan.cc
Removed exception throwers declaration.
* src/DirectDiskAdaptor.{h, cc}
* src/SocketCore.{h, cc}
* src/MultiDiskAdaptor.{h, cc}
* src/HttpConnection.{h, cc}
* src/HttpResponse.{h, cc}
* src/DiskAdaptor.{h, cc}
* src/CopyDiskAdaptor.{h, cc}
* src/MultiDiskAdaptor.{h, cc}
* src/HttpHeaderProcessor.{h, cc}
* src/AbstractSingleDiskAdaptor.{h, cc}
* src/Util.{h, cc}
* test/UtilTest.cc
* src/DefaultDiskWriter.{h, cc}
* src/FtpConnection.{h, cc}
* src/AbstractDiskWriter.{h, cc}
Removed duplicate code.
* src/StreamCheckIntegrityEntry.cc
Removed unnecessary include.
* src/DiskWriter.h
Included Exception.h
* src/option_processing.cc
Included 2 files and added doc
* src/TrackerWatcherCommand.cc
* src/SocketCore.cc (writeData): Fixed send error with GnuTLS.
2007-11-09 18:01:12 +00:00
|
|
|
|
2007-11-27 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Rewritten to add content-type support.
* src/DownloadHandler.{h, cc}
* src/BtPostDownloadHandler.{h, cc}
* test/BtPostDownloadHandlerTest.cc
* src/MetalinkPostDownloadHandler.{h, cc}
* test/MetalinkPostDownloadHandlerTest.cc
* src/PostDownloadHandler.{h, cc}
* src/DownloadHandlerConstants.{h, cc}
* src/RequestGroup.cc
* src/HttpResponseCommand.cc
* src/FtpNegotiationCommand.cc
* src/SingleFileDownloadContext.{h, cc}
* src/RequestGroup.h
* src/RequestGroupCriteria.h
* src/ContentTypeRequestGroupCriteria.h
Added 'mem' option value for --follow-metalink,
--follow-torrent.
If it is give, metalink/torrent file is not written to the disk,
but
just is kept in memory. Parsing is occurred on memory.
* src/MetalinkHelper.{h, cc}
* src/MetalinkProcessor.h
* src/Xml2MetalinkProcessor.{h, cc}
* test/Xml2MetalinkProcessorTest.cc
* src/DownloadHandlerFactory.{h, cc}
* test/DownloadHandlerFactoryTest.cc
* src/PreDownloadHandler.{h, cc}
* src/OptionHandlerFactory.cc
* src/DefaultBtContext.{h, cc}
* test/DefaultBtContextTest.cc
* src/version_usage.cc
* src/Metalink2RequestGroup.{h, cc}
* src/RequestGroup.{h, cc}
* src/a2functional.h
* test/a2functionalTest.cc
* src/MemoryBufferPreDownloadHandler.{h, cc}
* src/OptionHandlerImpl.h
* src/prefs.h
* src/Util.{h, cc}
* test/UtilTest.cc
Keep DownloadResult rather than RequestGroup after downloads to
reduce
memory usage.
* src/RequestGroupMan.{h, cc}
* src/DownloadEngine.cc
* src/BtDependency.{h, cc}: Changed the type of dependee from
WeakHandle to SharedHandle because WeakHandle could be null.
* src/RequestGroup.{h, cc}
* src/DownloadEngineFactory.cc
* src/DownloadResult.h
Set totalLength after download finished
* src/UnknownLengthPieceStorage.{h, cc}
Keep torrent file specified in metalink in memory.
* src/Metalink2RequestGroup.cc
* src/BtDependency.cc
* src/TrueRequestGroupCriteria.h
Fixed the bug: seekg is used where seekp should be used.
* src/ByteArrayDiskWriter.cc
* test/ByteArraydiskWriterTest.cc
2007-11-27 12:27:10 +00:00
|
|
|
void preDownloadProcessing();
|
|
|
|
|
|
|
|
void addPreDownloadHandler(const PreDownloadHandlerHandle& handler);
|
|
|
|
|
|
|
|
void clearPreDowloadHandler();
|
|
|
|
|
2007-11-10 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Don't connect server before checking file integrity at startup,
if
filesize and output file path are known.
* src/AbstractCommand.cc
* src/StreamFileAllocationEntry.cc
* src/Metalink2RequestGroup.cc
* src/RequestGroup.{h, cc}
* src/HttpResponseCommand.cc
* src/FtpNegotiationCommand.cc
Added DownloadFailureException. If it is thrown, RequestGroup
should
halt.
* src/AbstractCommand.cc
* src/DownloadFailureException.h
* src/RequestGroup.cc
Catch RecoverableException, instead of DlAbortEx.
* src/RequestGroupMan.cc
* src/FillRequestGroupCommand.cc
* src/MetaFileUtil.cc
* src/IteratableChunkChecksumValidator.cc
Now first parameter of MSG_DOWNLOAD_ABORTED is
gid(RequestGroup::
getGID())
* src/CheckIntegrityCommand.cc
* src/message.h
Print gid instead of idx.
* src/RequestGroupMan.cc
Removed exception throwers declaration.
* src/DirectDiskAdaptor.{h, cc}
* src/SocketCore.{h, cc}
* src/MultiDiskAdaptor.{h, cc}
* src/HttpConnection.{h, cc}
* src/HttpResponse.{h, cc}
* src/DiskAdaptor.{h, cc}
* src/CopyDiskAdaptor.{h, cc}
* src/MultiDiskAdaptor.{h, cc}
* src/HttpHeaderProcessor.{h, cc}
* src/AbstractSingleDiskAdaptor.{h, cc}
* src/Util.{h, cc}
* test/UtilTest.cc
* src/DefaultDiskWriter.{h, cc}
* src/FtpConnection.{h, cc}
* src/AbstractDiskWriter.{h, cc}
Removed duplicate code.
* src/StreamCheckIntegrityEntry.cc
Removed unnecessary include.
* src/DiskWriter.h
Included Exception.h
* src/option_processing.cc
Included 2 files and added doc
* src/TrackerWatcherCommand.cc
* src/SocketCore.cc (writeData): Fixed send error with GnuTLS.
2007-11-09 18:01:12 +00:00
|
|
|
Commands processCheckIntegrityEntry(const CheckIntegrityEntryHandle& entry, DownloadEngine* e);
|
|
|
|
|
|
|
|
void initPieceStorage();
|
|
|
|
|
|
|
|
bool downloadFinishedByFileLength();
|
|
|
|
|
|
|
|
void loadAndOpenFile(const BtProgressInfoFileHandle& progressInfoFile);
|
|
|
|
|
|
|
|
void shouldCancelDownloadForSafety();
|
2007-11-27 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Rewritten to add content-type support.
* src/DownloadHandler.{h, cc}
* src/BtPostDownloadHandler.{h, cc}
* test/BtPostDownloadHandlerTest.cc
* src/MetalinkPostDownloadHandler.{h, cc}
* test/MetalinkPostDownloadHandlerTest.cc
* src/PostDownloadHandler.{h, cc}
* src/DownloadHandlerConstants.{h, cc}
* src/RequestGroup.cc
* src/HttpResponseCommand.cc
* src/FtpNegotiationCommand.cc
* src/SingleFileDownloadContext.{h, cc}
* src/RequestGroup.h
* src/RequestGroupCriteria.h
* src/ContentTypeRequestGroupCriteria.h
Added 'mem' option value for --follow-metalink,
--follow-torrent.
If it is give, metalink/torrent file is not written to the disk,
but
just is kept in memory. Parsing is occurred on memory.
* src/MetalinkHelper.{h, cc}
* src/MetalinkProcessor.h
* src/Xml2MetalinkProcessor.{h, cc}
* test/Xml2MetalinkProcessorTest.cc
* src/DownloadHandlerFactory.{h, cc}
* test/DownloadHandlerFactoryTest.cc
* src/PreDownloadHandler.{h, cc}
* src/OptionHandlerFactory.cc
* src/DefaultBtContext.{h, cc}
* test/DefaultBtContextTest.cc
* src/version_usage.cc
* src/Metalink2RequestGroup.{h, cc}
* src/RequestGroup.{h, cc}
* src/a2functional.h
* test/a2functionalTest.cc
* src/MemoryBufferPreDownloadHandler.{h, cc}
* src/OptionHandlerImpl.h
* src/prefs.h
* src/Util.{h, cc}
* test/UtilTest.cc
Keep DownloadResult rather than RequestGroup after downloads to
reduce
memory usage.
* src/RequestGroupMan.{h, cc}
* src/DownloadEngine.cc
* src/BtDependency.{h, cc}: Changed the type of dependee from
WeakHandle to SharedHandle because WeakHandle could be null.
* src/RequestGroup.{h, cc}
* src/DownloadEngineFactory.cc
* src/DownloadResult.h
Set totalLength after download finished
* src/UnknownLengthPieceStorage.{h, cc}
Keep torrent file specified in metalink in memory.
* src/Metalink2RequestGroup.cc
* src/BtDependency.cc
* src/TrueRequestGroupCriteria.h
Fixed the bug: seekg is used where seekp should be used.
* src/ByteArrayDiskWriter.cc
* test/ByteArraydiskWriterTest.cc
2007-11-27 12:27:10 +00:00
|
|
|
|
|
|
|
DownloadResultHandle createDownloadResult() const;
|
|
|
|
|
|
|
|
const Option* getOption() const
|
|
|
|
{
|
|
|
|
return _option;
|
|
|
|
}
|
2007-05-20 13:57:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef SharedHandle<RequestGroup> RequestGroupHandle;
|
2007-10-11 16:58:24 +00:00
|
|
|
typedef WeakHandle<RequestGroup> RequestGroupWeakHandle;
|
2007-05-20 13:57:56 +00:00
|
|
|
typedef deque<RequestGroupHandle> RequestGroups;
|
|
|
|
|
|
|
|
#endif // _D_REQUEST_GROUP_H_
|