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
|
2010-01-05 16:01:46 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
2007-05-20 13:57:56 +00:00
|
|
|
*
|
|
|
|
* 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"
|
2008-11-03 06:49:02 +00:00
|
|
|
|
|
|
|
#include <string>
|
2010-02-25 14:40:18 +00:00
|
|
|
#include <algorithm>
|
2009-12-20 09:49:43 +00:00
|
|
|
#include <vector>
|
2008-11-03 06:49:02 +00:00
|
|
|
|
2008-02-08 15:53:45 +00:00
|
|
|
#include "SharedHandle.h"
|
2007-10-11 16:58:24 +00:00
|
|
|
#include "TransferStat.h"
|
2008-09-07 14:38:26 +00:00
|
|
|
#include "TimeA2.h"
|
2008-11-23 15:00:44 +00:00
|
|
|
#include "Request.h"
|
2009-06-29 08:42:58 +00:00
|
|
|
#include "DownloadResultCode.h"
|
2010-04-08 12:54:14 +00:00
|
|
|
#include "MetadataInfo.h"
|
2008-02-08 15:53:45 +00:00
|
|
|
|
|
|
|
namespace aria2 {
|
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;
|
|
|
|
class Command;
|
2009-01-06 13:13:42 +00:00
|
|
|
class DownloadCommand;
|
2007-10-11 16:58:24 +00:00
|
|
|
class DownloadContext;
|
|
|
|
class PieceStorage;
|
|
|
|
class BtProgressInfoFile;
|
|
|
|
class Dependency;
|
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;
|
2007-10-11 16:58:24 +00:00
|
|
|
class PostDownloadHandler;
|
|
|
|
class DiskWriterFactory;
|
|
|
|
class Option;
|
|
|
|
class Logger;
|
|
|
|
class RequestGroup;
|
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;
|
2010-06-13 02:21:40 +00:00
|
|
|
struct DownloadResult;
|
2008-08-04 17:06:47 +00:00
|
|
|
class URISelector;
|
2009-06-29 08:42:58 +00:00
|
|
|
class URIResult;
|
2010-03-05 14:02:23 +00:00
|
|
|
class RequestGroupMan;
|
2008-11-03 06:49:02 +00:00
|
|
|
#ifdef ENABLE_BITTORRENT
|
|
|
|
class BtRuntime;
|
|
|
|
class PeerStorage;
|
|
|
|
#endif // ENABLE_BITTORRENT
|
2007-05-20 13:57:56 +00:00
|
|
|
|
2010-03-21 14:04:05 +00:00
|
|
|
typedef int64_t gid_t;
|
2010-03-20 15:01:56 +00:00
|
|
|
|
2007-05-20 13:57:56 +00:00
|
|
|
class RequestGroup {
|
2009-05-09 04:11:31 +00:00
|
|
|
public:
|
|
|
|
enum HaltReason {
|
|
|
|
NONE,
|
|
|
|
SHUTDOWN_SIGNAL,
|
|
|
|
USER_REQUEST
|
|
|
|
};
|
2007-05-20 13:57:56 +00:00
|
|
|
private:
|
2010-03-20 15:01:56 +00:00
|
|
|
static gid_t _gidCounter;
|
2007-10-11 16:58:24 +00:00
|
|
|
|
2010-03-20 15:01:56 +00:00
|
|
|
gid_t _gid;
|
2007-10-11 16:58:24 +00:00
|
|
|
|
2009-05-08 16:41:21 +00:00
|
|
|
SharedHandle<Option> _option;
|
|
|
|
|
2009-06-29 08:42:58 +00:00
|
|
|
size_t _numConcurrentCommand;
|
2007-10-11 16:58:24 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This is the number of connections used in streaming protocol(http/ftp)
|
|
|
|
*/
|
2008-03-09 12:24:01 +00:00
|
|
|
unsigned int _numStreamConnection;
|
2007-10-11 16:58:24 +00:00
|
|
|
|
2008-03-09 12:24:01 +00:00
|
|
|
unsigned int _numCommand;
|
2007-10-11 16:58:24 +00:00
|
|
|
|
2008-02-08 15:53:45 +00:00
|
|
|
SharedHandle<SegmentMan> _segmentMan;
|
2007-10-11 16:58:24 +00:00
|
|
|
|
2008-02-08 15:53:45 +00:00
|
|
|
SharedHandle<DownloadContext> _downloadContext;
|
2007-10-11 16:58:24 +00:00
|
|
|
|
2008-02-08 15:53:45 +00:00
|
|
|
SharedHandle<PieceStorage> _pieceStorage;
|
2007-10-11 16:58:24 +00:00
|
|
|
|
2009-10-05 13:35:09 +00:00
|
|
|
bool _saveControlFile;
|
|
|
|
|
2008-02-08 15:53:45 +00:00
|
|
|
SharedHandle<BtProgressInfoFile> _progressInfoFile;
|
2007-10-11 16:58:24 +00:00
|
|
|
|
2008-02-08 15:53:45 +00:00
|
|
|
SharedHandle<DiskWriterFactory> _diskWriterFactory;
|
2007-10-11 16:58:24 +00:00
|
|
|
|
2008-02-08 15:53:45 +00:00
|
|
|
SharedHandle<Dependency> _dependency;
|
2007-10-11 16:58:24 +00:00
|
|
|
|
|
|
|
bool _fileAllocationEnabled;
|
|
|
|
|
|
|
|
bool _preLocalFileCheckEnabled;
|
|
|
|
|
|
|
|
bool _haltRequested;
|
|
|
|
|
2007-12-07 13:33:59 +00:00
|
|
|
bool _forceHaltRequested;
|
|
|
|
|
2009-05-09 04:11:31 +00:00
|
|
|
HaltReason _haltReason;
|
|
|
|
|
2010-04-08 16:02:22 +00:00
|
|
|
bool _pauseRequested;
|
|
|
|
|
2010-02-28 12:30:11 +00:00
|
|
|
std::vector<SharedHandle<PreDownloadHandler> > _preDownloadHandlers;
|
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
|
|
|
|
2010-02-28 12:30:11 +00:00
|
|
|
std::vector<SharedHandle<PostDownloadHandler> > _postDownloadHandlers;
|
2007-10-11 16:58:24 +00:00
|
|
|
|
2010-02-28 12:30:11 +00:00
|
|
|
std::vector<std::string> _acceptTypes;
|
2008-05-05 08:25:41 +00:00
|
|
|
|
2008-08-04 17:06:47 +00:00
|
|
|
SharedHandle<URISelector> _uriSelector;
|
|
|
|
|
2008-09-07 14:38:26 +00:00
|
|
|
Time _lastModifiedTime;
|
|
|
|
|
2008-09-10 14:56:44 +00:00
|
|
|
unsigned int _fileNotFoundCount;
|
|
|
|
|
2009-02-01 02:55:44 +00:00
|
|
|
// Timeout used for HTTP/FTP downloads.
|
|
|
|
time_t _timeout;
|
|
|
|
|
2008-11-13 15:08:52 +00:00
|
|
|
#ifdef ENABLE_BITTORRENT
|
2008-11-03 06:49:02 +00:00
|
|
|
WeakHandle<BtRuntime> _btRuntime;
|
|
|
|
|
|
|
|
WeakHandle<PeerStorage> _peerStorage;
|
2008-11-13 15:08:52 +00:00
|
|
|
#endif // ENABLE_BITTORRENT
|
2008-11-03 06:49:02 +00:00
|
|
|
|
2008-11-14 12:02:16 +00:00
|
|
|
// This flag just indicates that the downloaded file is not saved disk but
|
|
|
|
// just sits in memory.
|
|
|
|
bool _inMemoryDownload;
|
|
|
|
|
2009-02-28 11:48:26 +00:00
|
|
|
unsigned int _maxDownloadSpeedLimit;
|
|
|
|
|
|
|
|
unsigned int _maxUploadSpeedLimit;
|
|
|
|
|
2009-06-29 08:42:58 +00:00
|
|
|
SharedHandle<URIResult> _lastUriResult;
|
|
|
|
|
2009-12-20 09:49:43 +00:00
|
|
|
// If this download generates another downloads when completed(for
|
|
|
|
// example, downloads generated by PostDownloadHandler), this field
|
|
|
|
// has the GID of generated RequestGroups. empty list means there is
|
|
|
|
// no such RequestGroup.
|
2010-03-20 15:01:56 +00:00
|
|
|
std::vector<gid_t> _followedByGIDs;
|
2009-12-20 09:49:43 +00:00
|
|
|
|
|
|
|
// If this download is a part of another download(for example,
|
|
|
|
// downloading torrent file described in Metalink file), this field
|
|
|
|
// has the GID of parent RequestGroup. 0 means this is a parent
|
|
|
|
// RequestGroup.
|
2010-03-20 15:01:56 +00:00
|
|
|
gid_t _belongsToGID;
|
2009-12-20 09:49:43 +00:00
|
|
|
|
2010-04-08 12:54:14 +00:00
|
|
|
SharedHandle<MetadataInfo> _metadataInfo;
|
|
|
|
|
2010-03-05 14:02:23 +00:00
|
|
|
RequestGroupMan* _requestGroupMan;
|
|
|
|
|
2010-03-28 07:23:33 +00:00
|
|
|
int _resumeFailureCount;
|
|
|
|
|
2008-04-26 05:58:49 +00:00
|
|
|
Logger* _logger;
|
2007-05-20 13:57:56 +00:00
|
|
|
|
2008-02-08 15:53:45 +00:00
|
|
|
void validateFilename(const std::string& expectedFilename,
|
2010-01-05 16:01:46 +00:00
|
|
|
const std::string& actualFilename) const;
|
2007-05-20 13:57:56 +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 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();
|
|
|
|
|
2009-06-29 08:42:58 +00:00
|
|
|
// Returns the result code of this RequestGroup. If the download
|
|
|
|
// finished, then returns downloadresultcode::FINISHED. If the
|
|
|
|
// download didn't finish and error result is available in
|
|
|
|
// _uriResults, then last result code is returned. Otherwise
|
|
|
|
// returns downloadresultcode::UNKNOWN_ERROR.
|
|
|
|
downloadresultcode::RESULT downloadResult() const;
|
2010-02-26 15:37:08 +00:00
|
|
|
|
|
|
|
void removeDefunctControlFile
|
|
|
|
(const SharedHandle<BtProgressInfoFile>& progressInfoFile);
|
2007-05-20 13:57:56 +00:00
|
|
|
public:
|
2009-11-23 13:17:48 +00:00
|
|
|
// The copy of option is stored in RequestGroup object.
|
2009-06-29 08:42:58 +00:00
|
|
|
RequestGroup(const SharedHandle<Option>& option);
|
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
|
|
|
|
2009-05-29 12:12:22 +00:00
|
|
|
const SharedHandle<SegmentMan>& getSegmentMan() const
|
|
|
|
{
|
|
|
|
return _segmentMan;
|
|
|
|
}
|
2007-10-11 16:58:24 +00:00
|
|
|
|
2008-11-23 15:00:44 +00:00
|
|
|
// Returns first bootstrap commands to initiate a download.
|
|
|
|
// If this is HTTP/FTP download and file size is unknown, only 1 command
|
2009-07-04 14:32:53 +00:00
|
|
|
// (usually, HttpInitiateConnection or FtpInitiateConnection) will be created.
|
2010-02-28 12:30:11 +00:00
|
|
|
void createInitialCommand(std::vector<Command*>& commands,
|
2010-01-05 16:01:46 +00:00
|
|
|
DownloadEngine* e);
|
2007-05-20 13:57:56 +00:00
|
|
|
|
2010-02-28 12:30:11 +00:00
|
|
|
void createNextCommandWithAdj(std::vector<Command*>& commands,
|
2010-01-05 16:01:46 +00:00
|
|
|
DownloadEngine* e, int numAdj);
|
2007-06-03 14:24:37 +00:00
|
|
|
|
2010-02-28 12:30:11 +00:00
|
|
|
void createNextCommand(std::vector<Command*>& commands,
|
2010-01-05 16:01:46 +00:00
|
|
|
DownloadEngine* e, unsigned int numCommand);
|
2007-05-20 13:57:56 +00:00
|
|
|
|
2010-03-07 03:10:19 +00:00
|
|
|
void createNextCommand(std::vector<Command*>& commands, DownloadEngine* e);
|
|
|
|
|
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
|
|
|
|
2009-06-28 10:37:15 +00:00
|
|
|
std::string getFirstFilePath() const;
|
2007-05-20 13:57:56 +00:00
|
|
|
|
2008-03-09 12:24:01 +00:00
|
|
|
uint64_t getTotalLength() const;
|
2007-05-20 13:57:56 +00:00
|
|
|
|
2008-03-09 12:24:01 +00:00
|
|
|
uint64_t getCompletedLength() 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
|
|
|
*/
|
2008-02-08 15:53:45 +00:00
|
|
|
void validateFilename(const std::string& actualFilename) const;
|
2007-05-20 13:57:56 +00:00
|
|
|
|
2009-06-23 15:35:45 +00:00
|
|
|
void validateTotalLength(uint64_t expectedTotalLength,
|
2010-01-05 16:01:46 +00:00
|
|
|
uint64_t actualTotalLength) const;
|
2009-06-23 15:35:45 +00:00
|
|
|
|
2008-03-09 12:24:01 +00:00
|
|
|
void validateTotalLength(uint64_t actualTotalLength) const;
|
2007-05-20 13:57:56 +00:00
|
|
|
|
2008-03-09 12:24:01 +00:00
|
|
|
void setNumConcurrentCommand(unsigned int num)
|
2007-06-03 14:24:37 +00:00
|
|
|
{
|
|
|
|
_numConcurrentCommand = num;
|
|
|
|
}
|
2007-06-04 12:52:57 +00:00
|
|
|
|
2009-05-29 12:12:22 +00:00
|
|
|
unsigned int getNumConcurrentCommand() const
|
|
|
|
{
|
|
|
|
return _numConcurrentCommand;
|
|
|
|
}
|
2008-11-13 13:40:40 +00:00
|
|
|
|
2010-03-20 15:01:56 +00:00
|
|
|
gid_t getGID() const
|
2007-10-11 16:58:24 +00:00
|
|
|
{
|
|
|
|
return _gid;
|
|
|
|
}
|
|
|
|
|
2010-05-22 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Added totalLength, completedLength, uploadLength, bitfield,
downloadSpeed, uploadSpeed, infoHash, numSeeders, pieceLength,
numPieces, connections and dir to the response of
aria2.tellStopped XML-RPC method. aria2.tellWaiting now always
returns numSeeders for BitTorrent download.
* src/DownloadResult.h
* src/RequestGroup.cc
* src/RequestGroup.h
* src/XmlRpcMethodImpl.cc
* test/XmlRpcMethodTest.cc
2010-05-22 11:50:47 +00:00
|
|
|
TransferStat calculateStat() const;
|
2007-10-11 16:58:24 +00:00
|
|
|
|
2009-05-29 12:12:22 +00:00
|
|
|
const SharedHandle<DownloadContext>& getDownloadContext() const
|
|
|
|
{
|
|
|
|
return _downloadContext;
|
|
|
|
}
|
2007-10-11 16:58:24 +00:00
|
|
|
|
2009-11-28 10:12:04 +00:00
|
|
|
// This function also calls
|
|
|
|
// downloadContext->setOwnerRequestGroup(this).
|
|
|
|
void setDownloadContext(const SharedHandle<DownloadContext>& downloadContext);
|
2007-10-11 16:58:24 +00:00
|
|
|
|
2009-05-29 12:12:22 +00:00
|
|
|
const SharedHandle<PieceStorage>& getPieceStorage() const
|
|
|
|
{
|
|
|
|
return _pieceStorage;
|
|
|
|
}
|
2007-10-11 16:58:24 +00:00
|
|
|
|
2008-02-08 15:53:45 +00:00
|
|
|
void setPieceStorage(const SharedHandle<PieceStorage>& pieceStorage);
|
2007-10-11 16:58:24 +00:00
|
|
|
|
2008-02-08 15:53:45 +00:00
|
|
|
void setProgressInfoFile(const SharedHandle<BtProgressInfoFile>& progressInfoFile);
|
2007-10-11 16:58:24 +00:00
|
|
|
|
|
|
|
void increaseStreamConnection();
|
|
|
|
|
|
|
|
void decreaseStreamConnection();
|
|
|
|
|
2009-06-29 15:18:21 +00:00
|
|
|
// Returns the number of connections used in HTTP(S)/FTP.
|
|
|
|
unsigned int getNumStreamConnection() { return _numStreamConnection; }
|
|
|
|
|
2008-03-09 12:24:01 +00:00
|
|
|
unsigned int getNumConnection() const;
|
2007-10-11 16:58:24 +00:00
|
|
|
|
|
|
|
void increaseNumCommand();
|
|
|
|
|
|
|
|
void decreaseNumCommand();
|
|
|
|
|
2008-03-09 12:24:01 +00:00
|
|
|
unsigned int getNumCommand() const
|
2007-10-11 16:58:24 +00:00
|
|
|
{
|
|
|
|
return _numCommand;
|
|
|
|
}
|
|
|
|
|
|
|
|
// TODO is it better to move the following 2 methods to SingleFileDownloadContext?
|
2008-02-08 15:53:45 +00:00
|
|
|
void setDiskWriterFactory(const SharedHandle<DiskWriterFactory>& diskWriterFactory);
|
2007-06-10 15:22:36 +00:00
|
|
|
|
2009-05-29 12:12:22 +00:00
|
|
|
const SharedHandle<DiskWriterFactory>& getDiskWriterFactory() const
|
|
|
|
{
|
|
|
|
return _diskWriterFactory;
|
|
|
|
}
|
2007-10-11 16:58:24 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
2009-05-09 04:11:31 +00:00
|
|
|
void setHaltRequested(bool f, HaltReason = SHUTDOWN_SIGNAL);
|
2007-10-11 16:58:24 +00:00
|
|
|
|
2009-05-09 04:11:31 +00:00
|
|
|
void setForceHaltRequested(bool f, HaltReason = SHUTDOWN_SIGNAL);
|
2007-12-07 13:33:59 +00:00
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2010-04-08 16:02:22 +00:00
|
|
|
void setPauseRequested(bool f);
|
|
|
|
|
|
|
|
bool isPauseRequested() const
|
|
|
|
{
|
|
|
|
return _pauseRequested;
|
|
|
|
}
|
|
|
|
|
2008-02-08 15:53:45 +00:00
|
|
|
void dependsOn(const SharedHandle<Dependency>& dep);
|
2007-10-11 16:58:24 +00:00
|
|
|
|
|
|
|
bool isDependencyResolved();
|
|
|
|
|
2008-11-03 06:49:02 +00:00
|
|
|
void releaseRuntimeResource(DownloadEngine* e);
|
2007-10-11 16:58:24 +00:00
|
|
|
|
2010-02-28 12:30:11 +00:00
|
|
|
void postDownloadProcessing(std::vector<SharedHandle<RequestGroup> >& groups);
|
2007-10-11 16:58:24 +00:00
|
|
|
|
2008-02-08 15:53:45 +00:00
|
|
|
void addPostDownloadHandler(const SharedHandle<PostDownloadHandler>& handler);
|
2007-10-11 16:58:24 +00:00
|
|
|
|
2009-11-23 13:17:48 +00:00
|
|
|
void clearPostDownloadHandler();
|
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();
|
|
|
|
|
2008-02-08 15:53:45 +00:00
|
|
|
void addPreDownloadHandler(const SharedHandle<PreDownloadHandler>& handler);
|
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
|
|
|
|
2009-11-23 13:17:48 +00:00
|
|
|
void clearPreDownloadHandler();
|
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
|
|
|
|
2010-02-28 12:30:11 +00:00
|
|
|
void processCheckIntegrityEntry(std::vector<Command*>& commands,
|
2010-01-05 16:01:46 +00:00
|
|
|
const SharedHandle<CheckIntegrityEntry>& entry,
|
|
|
|
DownloadEngine* e);
|
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
|
|
|
|
2010-01-29 11:03:14 +00:00
|
|
|
// Initializes _pieceStorage and _segmentMan. We guarantee that
|
|
|
|
// either both of _pieceStorage and _segmentMan are initialized or
|
|
|
|
// they are not.
|
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
|
|
|
void initPieceStorage();
|
|
|
|
|
2010-04-13 12:39:09 +00:00
|
|
|
void dropPieceStorage();
|
|
|
|
|
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 downloadFinishedByFileLength();
|
|
|
|
|
2008-02-08 15:53:45 +00:00
|
|
|
void loadAndOpenFile(const SharedHandle<BtProgressInfoFile>& progressInfoFile);
|
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
|
|
|
|
|
|
|
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
|
|
|
|
2009-05-07 03:49:27 +00:00
|
|
|
void adjustFilename(const SharedHandle<BtProgressInfoFile>& infoFile);
|
|
|
|
|
2008-02-08 15:53:45 +00:00
|
|
|
SharedHandle<DownloadResult> createDownloadResult() 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
|
|
|
|
2009-05-08 16:41:21 +00:00
|
|
|
const SharedHandle<Option>& getOption() 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
|
|
|
{
|
|
|
|
return _option;
|
|
|
|
}
|
2007-12-12 13:53:33 +00:00
|
|
|
|
2007-12-29 07:02:35 +00:00
|
|
|
void reportDownloadFinished();
|
2008-04-25 17:44:03 +00:00
|
|
|
|
2010-02-28 12:30:11 +00:00
|
|
|
const std::vector<std::string>& getAcceptTypes() const
|
2009-05-29 12:12:22 +00:00
|
|
|
{
|
|
|
|
return _acceptTypes;
|
|
|
|
}
|
2008-05-05 08:25:41 +00:00
|
|
|
|
|
|
|
void addAcceptType(const std::string& type);
|
|
|
|
|
2010-02-25 14:40:18 +00:00
|
|
|
template<typename InputIterator>
|
|
|
|
void addAcceptType(InputIterator first, InputIterator last)
|
|
|
|
{
|
|
|
|
for(; first != last; ++first) {
|
|
|
|
if(std::find(_acceptTypes.begin(), _acceptTypes.end(), *first) ==
|
|
|
|
_acceptTypes.end()) {
|
|
|
|
_acceptTypes.push_back(*first);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2008-05-05 08:25:41 +00:00
|
|
|
|
2010-02-25 14:40:18 +00:00
|
|
|
void removeAcceptType(const std::string& type);
|
2008-08-04 17:06:47 +00:00
|
|
|
|
|
|
|
void setURISelector(const SharedHandle<URISelector>& uriSelector);
|
2008-09-07 14:38:26 +00:00
|
|
|
|
2009-06-23 15:35:45 +00:00
|
|
|
const SharedHandle<URISelector>& getURISelector() const
|
|
|
|
{
|
|
|
|
return _uriSelector;
|
|
|
|
}
|
|
|
|
|
2008-09-07 14:38:26 +00:00
|
|
|
void applyLastModifiedTimeToLocalFiles();
|
|
|
|
|
|
|
|
void updateLastModifiedTime(const Time& time);
|
2008-09-10 14:56:44 +00:00
|
|
|
|
|
|
|
void increaseAndValidateFileNotFoundCount();
|
2008-11-14 12:02:16 +00:00
|
|
|
|
|
|
|
// Just set inMemoryDownload flag true.
|
|
|
|
void markInMemoryDownload();
|
|
|
|
|
|
|
|
// Returns inMemoryDownload flag.
|
2009-05-29 12:12:22 +00:00
|
|
|
bool inMemoryDownload() const
|
|
|
|
{
|
|
|
|
return _inMemoryDownload;
|
|
|
|
}
|
2009-01-06 13:13:42 +00:00
|
|
|
|
2009-02-01 02:55:44 +00:00
|
|
|
void setTimeout(time_t timeout);
|
|
|
|
|
2009-05-29 12:12:22 +00:00
|
|
|
time_t getTimeout() const
|
|
|
|
{
|
|
|
|
return _timeout;
|
|
|
|
}
|
2009-02-01 03:03:17 +00:00
|
|
|
|
2009-02-28 11:48:26 +00:00
|
|
|
// Returns true if current download speed exceeds
|
|
|
|
// _maxDownloadSpeedLimit. Always returns false if
|
|
|
|
// _maxDownloadSpeedLimit == 0. Otherwise returns false.
|
|
|
|
bool doesDownloadSpeedExceed();
|
|
|
|
|
|
|
|
// Returns true if current upload speed exceeds
|
|
|
|
// _maxUploadSpeedLimit. Always returns false if
|
|
|
|
// _maxUploadSpeedLimit == 0. Otherwise returns false.
|
|
|
|
bool doesUploadSpeedExceed();
|
2009-05-07 08:40:45 +00:00
|
|
|
|
|
|
|
unsigned int getMaxDownloadSpeedLimit() const
|
|
|
|
{
|
|
|
|
return _maxDownloadSpeedLimit;
|
|
|
|
}
|
|
|
|
|
2009-05-14 15:23:50 +00:00
|
|
|
void setMaxDownloadSpeedLimit(unsigned int speed)
|
|
|
|
{
|
|
|
|
_maxDownloadSpeedLimit = speed;
|
|
|
|
}
|
|
|
|
|
2009-05-07 08:40:45 +00:00
|
|
|
unsigned int getMaxUploadSpeedLimit() const
|
|
|
|
{
|
|
|
|
return _maxUploadSpeedLimit;
|
|
|
|
}
|
2009-05-14 15:23:50 +00:00
|
|
|
|
|
|
|
void setMaxUploadSpeedLimit(unsigned int speed)
|
|
|
|
{
|
|
|
|
_maxUploadSpeedLimit = speed;
|
|
|
|
}
|
|
|
|
|
2009-06-29 08:42:58 +00:00
|
|
|
void setLastUriResult(std::string uri, downloadresultcode::RESULT result);
|
|
|
|
|
2009-10-05 13:35:09 +00:00
|
|
|
void saveControlFile() const;
|
|
|
|
|
|
|
|
void removeControlFile() const;
|
|
|
|
|
|
|
|
void enableSaveControlFile() { _saveControlFile = true; }
|
|
|
|
|
|
|
|
void disableSaveControlFile() { _saveControlFile = false; }
|
|
|
|
|
2009-12-20 09:49:43 +00:00
|
|
|
template<typename InputIterator>
|
|
|
|
void followedBy(InputIterator groupFirst, InputIterator groupLast)
|
|
|
|
{
|
|
|
|
_followedByGIDs.clear();
|
|
|
|
for(; groupFirst != groupLast; ++groupFirst) {
|
|
|
|
_followedByGIDs.push_back((*groupFirst)->getGID());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-03-20 15:01:56 +00:00
|
|
|
const std::vector<gid_t>& followedBy() const
|
2009-12-20 09:49:43 +00:00
|
|
|
{
|
|
|
|
return _followedByGIDs;
|
|
|
|
}
|
|
|
|
|
2010-03-20 15:01:56 +00:00
|
|
|
void belongsTo(gid_t gid)
|
2009-12-20 09:49:43 +00:00
|
|
|
{
|
|
|
|
_belongsToGID = gid;
|
|
|
|
}
|
|
|
|
|
2010-03-20 15:01:56 +00:00
|
|
|
gid_t belongsTo() const
|
2009-12-20 09:49:43 +00:00
|
|
|
{
|
|
|
|
return _belongsToGID;
|
|
|
|
}
|
|
|
|
|
2010-03-05 14:02:23 +00:00
|
|
|
void setRequestGroupMan(RequestGroupMan* requestGroupMan)
|
|
|
|
{
|
|
|
|
_requestGroupMan = requestGroupMan;
|
|
|
|
}
|
|
|
|
|
2010-03-28 07:23:33 +00:00
|
|
|
int getResumeFailureCount() const
|
|
|
|
{
|
|
|
|
return _resumeFailureCount;
|
|
|
|
}
|
|
|
|
|
|
|
|
void increaseResumeFailureCount()
|
|
|
|
{
|
|
|
|
++_resumeFailureCount;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool p2pInvolved() const;
|
|
|
|
|
2010-04-08 12:54:14 +00:00
|
|
|
void setMetadataInfo(const SharedHandle<MetadataInfo>& info)
|
|
|
|
{
|
|
|
|
_metadataInfo = info;
|
|
|
|
}
|
|
|
|
|
|
|
|
const SharedHandle<MetadataInfo>& getMetadataInfo() const
|
|
|
|
{
|
|
|
|
return _metadataInfo;
|
|
|
|
}
|
|
|
|
|
2009-05-14 15:23:50 +00:00
|
|
|
static void resetGIDCounter() { _gidCounter = 0; }
|
2010-01-10 07:51:45 +00:00
|
|
|
|
2010-03-20 15:01:56 +00:00
|
|
|
static gid_t newGID();
|
2007-05-20 13:57:56 +00:00
|
|
|
};
|
|
|
|
|
2008-02-08 15:53:45 +00:00
|
|
|
} // namespace aria2
|
2007-05-20 13:57:56 +00:00
|
|
|
|
|
|
|
#endif // _D_REQUEST_GROUP_H_
|