2006-02-17 13:35:04 +00:00
|
|
|
/* <!-- copyright */
|
|
|
|
/*
|
2006-09-21 15:31:24 +00:00
|
|
|
* aria2 - The high speed download utility
|
2006-02-17 13:35:04 +00:00
|
|
|
*
|
|
|
|
* 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
|
2006-09-21 15:31:24 +00:00
|
|
|
* 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.
|
2006-02-17 13:35:04 +00:00
|
|
|
*/
|
|
|
|
/* copyright --> */
|
|
|
|
#ifndef _D_SEGMENT_MAN_H_
|
|
|
|
#define _D_SEGMENT_MAN_H_
|
|
|
|
|
|
|
|
#include "common.h"
|
2008-02-08 15:53:45 +00:00
|
|
|
#include "SharedHandle.h"
|
|
|
|
#include <deque>
|
|
|
|
|
|
|
|
namespace aria2 {
|
2006-02-17 13:35:04 +00:00
|
|
|
|
2007-10-11 16:58:24 +00:00
|
|
|
class Segment;
|
|
|
|
class Logger;
|
|
|
|
class Option;
|
|
|
|
class PeerStat;
|
|
|
|
class DownloadContext;
|
|
|
|
class PieceStorage;
|
|
|
|
class Piece;
|
2006-02-17 13:35:04 +00:00
|
|
|
|
2006-09-19 14:52:59 +00:00
|
|
|
class SegmentEntry {
|
|
|
|
public:
|
2007-07-21 08:56:16 +00:00
|
|
|
int32_t cuid;
|
2008-02-08 15:53:45 +00:00
|
|
|
SharedHandle<Segment> segment;
|
2006-09-19 14:52:59 +00:00
|
|
|
public:
|
2008-02-08 15:53:45 +00:00
|
|
|
SegmentEntry(int32_t cuid, const SharedHandle<Segment>& segment);
|
2007-10-11 16:58:24 +00:00
|
|
|
|
|
|
|
~SegmentEntry();
|
2006-09-19 14:52:59 +00:00
|
|
|
};
|
|
|
|
|
2006-09-21 06:56:54 +00:00
|
|
|
typedef SharedHandle<SegmentEntry> SegmentEntryHandle;
|
2008-02-08 15:53:45 +00:00
|
|
|
typedef std::deque<SegmentEntryHandle> SegmentEntries;
|
2006-09-19 14:52:59 +00:00
|
|
|
|
2006-02-17 13:35:04 +00:00
|
|
|
/**
|
|
|
|
* This class holds the download progress of the one download entry.
|
|
|
|
*/
|
|
|
|
class SegmentMan {
|
|
|
|
private:
|
2007-10-11 16:58:24 +00:00
|
|
|
const Option* _option;
|
|
|
|
|
2008-04-26 05:58:49 +00:00
|
|
|
Logger* logger;
|
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
|
|
|
|
2006-09-19 14:52:59 +00:00
|
|
|
SegmentEntries usedSegmentEntries;
|
2007-10-11 16:58:24 +00:00
|
|
|
|
2008-02-08 15:53:45 +00:00
|
|
|
std::deque<SharedHandle<PeerStat> > peerStats;
|
2006-04-17 16:17:20 +00:00
|
|
|
|
2008-02-08 15:53:45 +00:00
|
|
|
SharedHandle<Segment> checkoutSegment(int32_t cuid,
|
|
|
|
const SharedHandle<Piece>& piece);
|
2007-10-11 16:58:24 +00:00
|
|
|
|
2008-07-20 07:55:10 +00:00
|
|
|
SharedHandle<SegmentEntry> findSlowerSegmentEntry
|
|
|
|
(const SharedHandle<PeerStat>& peerStat);
|
2006-02-17 13:35:04 +00:00
|
|
|
public:
|
2007-10-11 16:58:24 +00:00
|
|
|
SegmentMan(const Option* option,
|
2008-04-20 00:50:22 +00:00
|
|
|
const SharedHandle<DownloadContext>& downloadContext,
|
|
|
|
const SharedHandle<PieceStorage>& pieceStorage);
|
2006-02-17 13:35:04 +00:00
|
|
|
|
2007-10-11 16:58:24 +00:00
|
|
|
~SegmentMan();
|
2006-06-12 16:55:08 +00:00
|
|
|
|
2006-02-17 13:35:04 +00:00
|
|
|
|
2006-06-12 16:55:08 +00:00
|
|
|
// Initializes totalSize, isSplittable, downloadStarted, errors.
|
2006-04-19 17:23:58 +00:00
|
|
|
// Clears command queue. Also, closes diskWriter.
|
2006-04-18 17:06:17 +00:00
|
|
|
void init();
|
|
|
|
|
2006-02-17 13:35:04 +00:00
|
|
|
/**
|
2007-10-11 16:58:24 +00:00
|
|
|
* The total number of bytes to download.
|
|
|
|
* If Transfer-Encoding is Chunked or Content-Length header is not provided,
|
|
|
|
* then this value is set to be 0.
|
2006-02-17 13:35:04 +00:00
|
|
|
*/
|
2008-03-08 10:33:56 +00:00
|
|
|
uint64_t getTotalLength() const;
|
2006-02-17 13:35:04 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returs true when the download has finished.
|
|
|
|
* If downloadStarted is false or the number of the segments of this object
|
|
|
|
* holds is 0, then returns false.
|
|
|
|
*/
|
2007-10-11 16:58:24 +00:00
|
|
|
bool downloadFinished() const;
|
|
|
|
|
2006-02-17 13:35:04 +00:00
|
|
|
/**
|
2008-05-11 10:46:52 +00:00
|
|
|
* Fill segments which are assigned to the command whose CUID is cuid.
|
|
|
|
* This function doesn't clear passed segments.
|
2006-09-19 14:52:59 +00:00
|
|
|
*/
|
2008-05-11 10:46:52 +00:00
|
|
|
void getInFlightSegment(std::deque<SharedHandle<Segment> >& segments,
|
|
|
|
int32_t cuid);
|
2008-02-08 15:53:45 +00:00
|
|
|
|
|
|
|
SharedHandle<Segment> getSegment(int32_t cuid);
|
|
|
|
|
2006-09-19 14:52:59 +00:00
|
|
|
/**
|
|
|
|
* Returns a segment whose index is index.
|
|
|
|
* If it has already assigned
|
|
|
|
* to another cuid or has been downloaded, then returns a segment instance
|
|
|
|
* whose isNull call is true.
|
|
|
|
*/
|
2008-03-08 10:33:56 +00:00
|
|
|
SharedHandle<Segment> getSegment(int32_t cuid, size_t index);
|
2006-09-19 14:52:59 +00:00
|
|
|
/**
|
|
|
|
* Updates download status.
|
|
|
|
*/
|
2007-03-15 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
To handle Segment as SegmentHandle:
* src/AbstractCommand.cc (execute): Rewritten.
* src/SegmentMan.h: Segment -> SegmentHandle
Introducded HttpResponse class, HttpRequest class to improve
code
extensiveness and make it clear:
* src/HttpDownloadCommand.cc: transfer encoders are now managed
by
HttpResponse class.
* src/HttpRequest.h, src/HttpRequest.cc: New class.
* src/HttpResponse.h, src/HttpResponse.cc: New class.
* src/HttpConnection.cc: Contruction of http request were moved
to
HttpRequest class.
* src/HttpResponseCommand.h, src/HttpResponseCommand.cc:
Refactored.
* src/HttpRequestCommand.cc (executeInternal): Rewritten.
* src/HttpAuthConfig.h: New class.
* src/Range.h: New class.
To make FtpTunnel{Request, Response}Command and
HttpProxy{Request, Response}Command derived from
AbstractProxy{Request, Response}Command:
* src/FtpTunnelResponseCommand.h,
src/FtpTunnelResponseCommand.cc:
Derived from AbstractProxyRequestCommand class.
* src/FtpTunnelRequestCommand.h, src/FtpTunnelRequestCommand.cc:
Derived from AbstractProxyResponseCommand class.
* src/HttpProxyRequestCommand.h, src/HttpProxyRequestCommand.cc:
Derived from AbstractProxyRequestCommand class.
* src/HttpProxyResponseCommand.h,
src/HttpProxyResponseCommand.cc:
Derived from AbstractProxyResponseCommand class.
* src/AbstractProxyRequestCommand.h,
src/AbstractProxyRequestCommand.cc
: New class.
* src/AbstractProxyResponseCommand.h,
src/AbstractProxyResponseCommand.cc: New class.
To add netrc support:
* src/Netrc.h, src/Netrc.cc: New class.
* src/Util.h, src/Util.cc (split): New function.
* src/HttpHeader.cc (getRange): Fixed so that it inspects
"Content-Range" header instead of "Range" header.
* src/HttpHeader.h
(getStatus): Removed.
(setStatus): Removed.
* src/Segment.h
(getPositionToWrite): New function.
2007-03-15 15:07:18 +00:00
|
|
|
//bool updateSegment(int cuid, const Segment& segment);
|
2006-09-19 14:52:59 +00:00
|
|
|
/**
|
|
|
|
* Cancels all the segment which the command having given cuid
|
|
|
|
* uses.
|
|
|
|
*/
|
2007-03-15 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
To handle Segment as SegmentHandle:
* src/AbstractCommand.cc (execute): Rewritten.
* src/SegmentMan.h: Segment -> SegmentHandle
Introducded HttpResponse class, HttpRequest class to improve
code
extensiveness and make it clear:
* src/HttpDownloadCommand.cc: transfer encoders are now managed
by
HttpResponse class.
* src/HttpRequest.h, src/HttpRequest.cc: New class.
* src/HttpResponse.h, src/HttpResponse.cc: New class.
* src/HttpConnection.cc: Contruction of http request were moved
to
HttpRequest class.
* src/HttpResponseCommand.h, src/HttpResponseCommand.cc:
Refactored.
* src/HttpRequestCommand.cc (executeInternal): Rewritten.
* src/HttpAuthConfig.h: New class.
* src/Range.h: New class.
To make FtpTunnel{Request, Response}Command and
HttpProxy{Request, Response}Command derived from
AbstractProxy{Request, Response}Command:
* src/FtpTunnelResponseCommand.h,
src/FtpTunnelResponseCommand.cc:
Derived from AbstractProxyRequestCommand class.
* src/FtpTunnelRequestCommand.h, src/FtpTunnelRequestCommand.cc:
Derived from AbstractProxyResponseCommand class.
* src/HttpProxyRequestCommand.h, src/HttpProxyRequestCommand.cc:
Derived from AbstractProxyRequestCommand class.
* src/HttpProxyResponseCommand.h,
src/HttpProxyResponseCommand.cc:
Derived from AbstractProxyResponseCommand class.
* src/AbstractProxyRequestCommand.h,
src/AbstractProxyRequestCommand.cc
: New class.
* src/AbstractProxyResponseCommand.h,
src/AbstractProxyResponseCommand.cc: New class.
To add netrc support:
* src/Netrc.h, src/Netrc.cc: New class.
* src/Util.h, src/Util.cc (split): New function.
* src/HttpHeader.cc (getRange): Fixed so that it inspects
"Content-Range" header instead of "Range" header.
* src/HttpHeader.h
(getStatus): Removed.
(setStatus): Removed.
* src/Segment.h
(getPositionToWrite): New function.
2007-03-15 15:07:18 +00:00
|
|
|
void cancelSegment(int32_t cuid);
|
2006-09-19 14:52:59 +00:00
|
|
|
/**
|
|
|
|
* Tells SegmentMan that the segment has been downloaded successfully.
|
|
|
|
*/
|
2008-02-08 15:53:45 +00:00
|
|
|
bool completeSegment(int32_t cuid, const SharedHandle<Segment>& segment);
|
2007-10-11 16:58:24 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Injects PieceStorage.
|
|
|
|
*/
|
2008-02-08 15:53:45 +00:00
|
|
|
void setPieceStorage(const SharedHandle<PieceStorage>& pieceStorage);
|
2007-10-11 16:58:24 +00:00
|
|
|
|
2006-09-19 14:52:59 +00:00
|
|
|
/**
|
2007-10-11 16:58:24 +00:00
|
|
|
* Injects DownloadContext.
|
2006-09-19 14:52:59 +00:00
|
|
|
*/
|
2008-02-08 15:53:45 +00:00
|
|
|
void setDownloadContext(const SharedHandle<DownloadContext>& downloadContext);
|
2007-10-11 16:58:24 +00:00
|
|
|
|
2006-09-19 14:52:59 +00:00
|
|
|
/**
|
|
|
|
* Returns true if the segment whose index is index has been downloaded.
|
|
|
|
*/
|
2008-03-08 10:33:56 +00:00
|
|
|
bool hasSegment(size_t index) const;
|
2006-09-19 14:52:59 +00:00
|
|
|
/**
|
|
|
|
* Returns the length of bytes downloaded.
|
|
|
|
*/
|
2008-03-08 10:33:56 +00:00
|
|
|
uint64_t getDownloadLength() const;
|
2006-09-19 14:52:59 +00:00
|
|
|
|
|
|
|
/**
|
2008-07-20 07:55:10 +00:00
|
|
|
* Registers given peerStat if it has not been registerd and returns true.
|
|
|
|
* Otherwise does nothing and returns false.
|
2006-09-19 14:52:59 +00:00
|
|
|
*/
|
2008-07-20 07:55:10 +00:00
|
|
|
bool registerPeerStat(const SharedHandle<PeerStat>& peerStat);
|
2006-09-19 14:52:59 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns peerStat whose cuid is given cuid. If it is not found, returns
|
2007-01-23 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
To add chunk checksum validation:
* src/MetalinkEntry.h
(MetalinkChunkChecksum.h): New include.
(chunkChecksum): New variable.
* src/Request.h
(method): New variable.
(setMethod): New function.
(getMethod): New function.
(METHOD_GET): New static constant.
(METHOD_HEAD): New static constant.
* src/Xml2MetalinkProcessor.h
(getPieceHash): New function.
* src/PieceStorage.h
(markAllPiecesDone): New function.
(checkIntegrity): New function.
* src/FileAllocator.h
(NullFileAllocationMonitor.h): New include.
(FileAllocator): Initialize fileAllocationMonitor with new
NullFileAllocationMonitor().
* src/MultiDiskAdaptor.h
(messageDigest.h): Remove include.
(ctx): Removed.
(hashUpdate): Added ctx.
(MultiDiskAdaptor): Removed ctx.
(sha1Sum): Renamed as messageDigest.
(messageDigest): New function.
* src/UrlRequestInfo.h
(HeadResult): New class.
(digestAlgo): New variable.
(chunkChecksumLength): New variable.
(chunkChecksums): New variable.
(getHeadResult): New function.
(UrlRequestInfo): Added digestAlgo, chunkChecksumLength.
(setDigestAlgo): New function.
(setChunkChecksumLength): New function.
(setChunkChecksums): New function.
* src/DefaultPieceStorage.cc
(DiskAdaptorWriter.h): New include.
(ChunkChecksumValidator.h): New include.
(markAllPiecesDone): New function.
(checkIntegrity): New function.
* src/DefaultBtContext.h
(getPieceHashes): New function.
* src/TorrentRequestInfo.cc
(execute): Try to validate chunk checksum if file already exists
and
.aria2 file doesn't there and user allows aria2 to overwrite it.
* src/messageDigest.h
(~MessageDigestContext): Added digestFree().
* src/MetalinkRequestInfo.cc
(execute): Set digestAlgo, chunkChecksum, chunkChecksums to
reqInfo.
* src/DiskAdaptor.h
(messageDigest.h): New include.
(sha1Sum): Renamed as messageDigest.
(messageDigest): New function.
* src/DownloadCommand.h
(PeerStat.h): New include.
(maxDownloadSpeedLimit): New variable.
(startupIdleTime): New variable.
(lowestDownloadSpeedLimit): New variable.
(peerStat): New variable.
(setMaxDownloadSpeedLimit): New function.
(setStartupIdleTime): New function.
(setLowestDownloadSPeedLimit): New function.
* src/BtContext.h
(getPieceHashes): New function.
* src/main.cc
(main): Set PREF_REALTIME_CHUNK_CHECKSUM and
PREF_CHECK_INTEGRITY
option to true for testing purpose.
* src/BtPieceMessage.cc
(checkPieceHash): Use messageDigest
* src/DownloadEngine.cc
(SetDescriptor): Removed.
(AccumulateActiveCommand): Removed.
(waitData): Rewritten.
(updateFdSet): Rewritten.
* src/MultiDiskAdaptor.cc
(hashUpdate): Added ctx.
(sha1Sum): Renamed as messageDigest.
(messageDigest): New function.
* src/BitfieldMan.h
(isBitRangeSet): New function.
(unsetBitRange): New function.
* src/ByteArrayDiskWriter.h
(sha1Sum): Renamed as messageDigest.
(messageDigest): New function.
* src/ConsoleDownloadEngine.cc
(calculateStatistics): If nspeed < 0 then set nspeed to 0.
* src/DiskWriter.h
(messageDigest.h): New include.
(sha1Sum): Renamed as messageDigest.
(messageDigest): New function.
* src/ChunkChecksumValidator.h: New class.
* src/DiskAdaptorWriter.h: New class.
* src/prefs.h
(PREF_REALTIME_CHUNK_CHECKSUM): New definition.
(PREF_CHECK_INTEGRITY): New definition.
* src/HttpResponseCommand.cc
(handleDefaultEncoding): Added method "HEAD" handling.
Removed the call to
e->segmentMan->shouldCancelDownloadForSafety().
(handleOtherEncoding):
Added the call to
e->segmentMan->shouldCancelDownloadForSafety().
(createHttpDownloadCommand): Set maxDownloadSpeedLimit,
startupIdleTime, lowestDownloadSpeedLimit to command.
* src/SegmentMan.h
(getSegmentEntryByIndex): New function.
(getSegmentEntryByCuid): New function.
(getSegmentEntryIteratorByCuid): New function.
(diskWriter): DiskWriter -> DiskWriterHandle
(pieceHashes): New variable.
(chunkHashLength): New variable.
(digestAlgo): New variable.
(FindPeerStat): Removed.
(getPeerStat): Rewritten.
(markAllPiecesDone): New function.
(checkIntegrity): New function.
(tryChunkChecksumValidation): New function.
(isChunkChecksumValidationReady): New function.
* src/BitfieldMan.cc
(BitfieldMan): Initialized bitfieldLength, blocks to 0.
(BitfieldMan): Initialized blockLength, totalLength,
bitfieldLength,
blocks to 0.
(isBitRangeSet): New function.
(unsetBitRange): New function.
* src/FtpNegotiateCommand.cc
(executeInternal): Set maxDownloadSpeedLimit,
startupIdleTime, lowestDownloadSpeedLimit to command.
(recvSize): Added method "HEAD" handling.
Removed the call to
e->segmentMan->shouldCancelDownloadForSafety().
* src/AbstractSingleDiskAdaptor.cc
(sha1Sum): Renamed as messageDigest.
(messageDigest): New function.
* src/AbstractSingleDiskAdaptor.h
(sha1Sum): Renamed as messageDigest.
(messageDigest): New function.
* src/Util.h
(indexRange): New function.
* src/MetalinkEntry.cc
(MetalinkEntry): Initialized chunkChecksum to 0.
* src/ShaVisitor.cc
(~ShaVisitor): Removed the call to ctx.digestFree().
* src/SegmentMan.cc
(ChunkChecksumValidator.h): New include.
(SegmentMan): Initialized chunkHashLength to 0. Initialized
digestAlgo
to DIGEST_ALGO_SHA1.
(~SegmentMan): Removed diskWriter.
(FindSegmentEntryByIndex): Removed.
(FindSegmentEntryByCuid): Removed.
(checkoutSegment): Rewritten.
(findSlowerSegmentEntry): Rewritten.
(getSegment): Rewritten.
(updateSegment): Rewritten.
(completeSegment): Rewritten.
(markAllPiecesDone): New function.
(checkIntegrity): New function.
(isChunkChecksumValidationReady): New function.
(tryChunkChecksumValidation): New function.
* src/Xml2MetalinkProcessor.cc
(getEntry): Get size and set it to entry.
Get chunk checksum and set it to entry.
(getPieceHash): New function.
* src/Util.cc
(sha1Sum): Removed ctx.digestFree()
(fileChecksum): Removed ctx.digestFree()
(indexRange): New function.
* src/Request.cc
(METHOD_GET): New variable.
(METHOD_HEAD): New variable.
(Request): Added method.
* src/UrlRequestInfo.cc
(FatalException.h): New include.
(message.h): New include.
(operator<<): Added operator<< for class HeadResult.
(getHeadResult): New function.
(execute): Get filename and size in separate download engine.
* src/ChunkChecksumValidator.cc: New class.
* src/DownloadCommand.cc:
(DownloadCommand): Added peerStat.
(executeInternal): Use maxDownloadSpeedLimit member instead of
getting
the value from Option.
The buffer size is now 16KB.
Use peerStat member instead of getting it from SegmentMan.
Use startupIdleTime member instead of gettingit from Option.
Added chunk checksum validation.
* src/AbstractDiskWriter.cc
(AbstractDiskWriter): Removed ctx.
(~AbstractDiskWriter): Removed ctx.digestFree()
(writeDataInternal): Returns the return value of write.
(readDataInternal): Returns the return value of read.
(sha1Sum): Renamed as messageDigest
(messageDigest): New function.
* src/AbstractDiwkWriter.h
(messageDigest.h): Removed include.
(ctx): Removed.
(sha1Sum): Renamed as messageDigest
(messageDigest): New function.
* src/DefaultPieceStorage.h
(markAllPiecesDone): New function.
(checkIntegrity): New function.
* src/NullFileAllocationMonitor.h: New class.
2007-01-24 15:55:34 +00:00
|
|
|
* 0.
|
2006-09-19 14:52:59 +00:00
|
|
|
*/
|
2008-02-08 15:53:45 +00:00
|
|
|
SharedHandle<PeerStat> getPeerStat(int32_t cuid) const;
|
2006-09-19 14:52:59 +00:00
|
|
|
|
2008-08-04 17:06:47 +00:00
|
|
|
|
|
|
|
const std::deque<SharedHandle<PeerStat> >& getPeerStats() const;
|
|
|
|
|
2006-09-19 14:52:59 +00:00
|
|
|
/**
|
|
|
|
* Returns current download speed in bytes per sec.
|
2006-02-17 13:35:04 +00:00
|
|
|
*/
|
2008-03-08 10:33:56 +00:00
|
|
|
unsigned int calculateDownloadSpeed() const;
|
2007-01-11 16:32:31 +00:00
|
|
|
|
2008-09-10 14:56:44 +00:00
|
|
|
/**
|
|
|
|
* Returns the downloaded bytes in this session.
|
|
|
|
*/
|
|
|
|
uint64_t calculateSessionDownloadLength() const;
|
|
|
|
|
2008-03-08 10:33:56 +00:00
|
|
|
size_t countFreePieceFrom(size_t index) const;
|
2006-02-17 13:35:04 +00:00
|
|
|
};
|
|
|
|
|
2007-05-20 13:51:52 +00:00
|
|
|
typedef SharedHandle<SegmentMan> SegmentManHandle;
|
2008-02-08 15:53:45 +00:00
|
|
|
|
|
|
|
} // namespace aria2
|
|
|
|
|
2006-02-17 13:35:04 +00:00
|
|
|
#endif // _D_SEGMENT_MAN_H_
|