mirror of https://github.com/aria2/aria2
2009-05-29 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Implemented getter methods in header files to give them more chance of optimization. Return const reference for SharadHandle if possible. * src/AbstractAuthResolver.cc * src/AbstractAuthResolver.h * src/AbstractBtMessage.cc * src/AbstractBtMessage.h * src/AbstractSingleDiskAdaptor.cc * src/AbstractSingleDiskAdaptor.h * src/AsyncNameResolver.cc * src/AsyncNameResolver.h * src/BNode.cc * src/BNode.h * src/BitfieldMan.cc * src/BitfieldMan.h * src/BtAbortOutstandingRequestEvent.h * src/BtExtendedMessage.cc * src/BtExtendedMessage.h * src/BtSeederStateChoke.cc * src/BtSeederStateChoke.h * src/Cookie.cc * src/Cookie.h * src/DHTBucket.cc * src/DHTBucket.h * src/DHTConnectionImpl.cc * src/DHTConnectionImpl.h * src/DHTFindNodeReplyMessage.cc * src/DHTFindNodeReplyMessage.h * src/DHTGetPeersReplyMessage.cc * src/DHTGetPeersReplyMessage.h * src/DHTInteractionCommand.cc * src/DHTMessage.cc * src/DHTMessage.h * src/DHTMessageDispatcherImpl.cc * src/DHTMessageEntry.cc * src/DHTMessageReceiver.cc * src/DHTMessageReceiver.h * src/DHTMessageTrackerEntry.cc * src/DHTMessageTrackerEntry.h * src/DHTPeerAnnounceEntry.cc * src/DHTPeerAnnounceEntry.h * src/DHTPeerLookupTask.cc * src/DHTPeerLookupTask.h * src/DHTRoutingTableDeserializer.cc * src/DHTRoutingTableDeserializer.h * src/DefaultBtAnnounce.cc * src/DefaultBtAnnounce.h * src/DefaultBtMessageDispatcher.cc * src/DefaultBtMessageDispatcher.h * src/DefaultBtRequestFactory.cc * src/DefaultBtRequestFactory.h * src/DiskAdaptor.cc * src/DiskAdaptor.h * src/DownloadContext.cc * src/DownloadContext.h * src/DownloadEngine.cc * src/DownloadEngine.h * src/EpollEventPoll.cc * src/EpollEventPoll.h * src/FtpConnection.cc * src/FtpConnection.h * src/HttpConnection.cc * src/HttpConnection.h * src/HttpHeader.cc * src/HttpHeader.h * src/HttpRequest.cc * src/HttpRequest.h * src/HttpResponse.cc * src/HttpResponse.h * src/LibsslTLSContext.cc * src/LibsslTLSContext.h * src/MSEHandshake.cc * src/MSEHandshake.h * src/MetalinkEntry.cc * src/MetalinkEntry.h * src/MetalinkParserController.cc * src/MetalinkParserController.h * src/MetalinkParserStateMachine.cc * src/MetalinkParserStateMachine.h * src/MultiDiskAdaptor.cc * src/MultiDiskAdaptor.h * src/NetrcAuthResolver.cc * src/NetrcAuthResolver.h * src/Peer.cc * src/Peer.h * src/PeerSessionResource.cc * src/PeerSessionResource.h * src/Piece.cc * src/Piece.h * src/PieceStatMan.cc * src/PieceStatMan.h * src/Request.cc * src/Request.h * src/RequestGroup.cc * src/RequestGroup.h * src/RequestGroupMan.cc * src/RequestGroupMan.h * src/RequestSlot.cc * src/RequestSlot.h * src/SegmentMan.cc * src/SegmentMan.h * src/SelectEventPoll.cc * src/SelectEventPoll.h * src/ServerStat.cc * src/ServerStat.h * src/Signature.cc * src/Signature.h * src/URIResult.cc * src/URIResult.h * src/UTPexExtensionMessage.cc * src/UTPexExtensionMessage.hpull/1/head
parent
30f362319e
commit
8b6da1ee36
114
ChangeLog
114
ChangeLog
|
@ -1,3 +1,117 @@
|
|||
2009-05-29 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||
|
||||
Implemented getter methods in header files to give them more
|
||||
chance of optimization.
|
||||
Return const reference for SharadHandle if possible.
|
||||
* src/AbstractAuthResolver.cc
|
||||
* src/AbstractAuthResolver.h
|
||||
* src/AbstractBtMessage.cc
|
||||
* src/AbstractBtMessage.h
|
||||
* src/AbstractSingleDiskAdaptor.cc
|
||||
* src/AbstractSingleDiskAdaptor.h
|
||||
* src/AsyncNameResolver.cc
|
||||
* src/AsyncNameResolver.h
|
||||
* src/BNode.cc
|
||||
* src/BNode.h
|
||||
* src/BitfieldMan.cc
|
||||
* src/BitfieldMan.h
|
||||
* src/BtAbortOutstandingRequestEvent.h
|
||||
* src/BtExtendedMessage.cc
|
||||
* src/BtExtendedMessage.h
|
||||
* src/BtSeederStateChoke.cc
|
||||
* src/BtSeederStateChoke.h
|
||||
* src/Cookie.cc
|
||||
* src/Cookie.h
|
||||
* src/DHTBucket.cc
|
||||
* src/DHTBucket.h
|
||||
* src/DHTConnectionImpl.cc
|
||||
* src/DHTConnectionImpl.h
|
||||
* src/DHTFindNodeReplyMessage.cc
|
||||
* src/DHTFindNodeReplyMessage.h
|
||||
* src/DHTGetPeersReplyMessage.cc
|
||||
* src/DHTGetPeersReplyMessage.h
|
||||
* src/DHTInteractionCommand.cc
|
||||
* src/DHTMessage.cc
|
||||
* src/DHTMessage.h
|
||||
* src/DHTMessageDispatcherImpl.cc
|
||||
* src/DHTMessageEntry.cc
|
||||
* src/DHTMessageReceiver.cc
|
||||
* src/DHTMessageReceiver.h
|
||||
* src/DHTMessageTrackerEntry.cc
|
||||
* src/DHTMessageTrackerEntry.h
|
||||
* src/DHTPeerAnnounceEntry.cc
|
||||
* src/DHTPeerAnnounceEntry.h
|
||||
* src/DHTPeerLookupTask.cc
|
||||
* src/DHTPeerLookupTask.h
|
||||
* src/DHTRoutingTableDeserializer.cc
|
||||
* src/DHTRoutingTableDeserializer.h
|
||||
* src/DefaultBtAnnounce.cc
|
||||
* src/DefaultBtAnnounce.h
|
||||
* src/DefaultBtMessageDispatcher.cc
|
||||
* src/DefaultBtMessageDispatcher.h
|
||||
* src/DefaultBtRequestFactory.cc
|
||||
* src/DefaultBtRequestFactory.h
|
||||
* src/DiskAdaptor.cc
|
||||
* src/DiskAdaptor.h
|
||||
* src/DownloadContext.cc
|
||||
* src/DownloadContext.h
|
||||
* src/DownloadEngine.cc
|
||||
* src/DownloadEngine.h
|
||||
* src/EpollEventPoll.cc
|
||||
* src/EpollEventPoll.h
|
||||
* src/FtpConnection.cc
|
||||
* src/FtpConnection.h
|
||||
* src/HttpConnection.cc
|
||||
* src/HttpConnection.h
|
||||
* src/HttpHeader.cc
|
||||
* src/HttpHeader.h
|
||||
* src/HttpRequest.cc
|
||||
* src/HttpRequest.h
|
||||
* src/HttpResponse.cc
|
||||
* src/HttpResponse.h
|
||||
* src/LibsslTLSContext.cc
|
||||
* src/LibsslTLSContext.h
|
||||
* src/MSEHandshake.cc
|
||||
* src/MSEHandshake.h
|
||||
* src/MetalinkEntry.cc
|
||||
* src/MetalinkEntry.h
|
||||
* src/MetalinkParserController.cc
|
||||
* src/MetalinkParserController.h
|
||||
* src/MetalinkParserStateMachine.cc
|
||||
* src/MetalinkParserStateMachine.h
|
||||
* src/MultiDiskAdaptor.cc
|
||||
* src/MultiDiskAdaptor.h
|
||||
* src/NetrcAuthResolver.cc
|
||||
* src/NetrcAuthResolver.h
|
||||
* src/Peer.cc
|
||||
* src/Peer.h
|
||||
* src/PeerSessionResource.cc
|
||||
* src/PeerSessionResource.h
|
||||
* src/Piece.cc
|
||||
* src/Piece.h
|
||||
* src/PieceStatMan.cc
|
||||
* src/PieceStatMan.h
|
||||
* src/Request.cc
|
||||
* src/Request.h
|
||||
* src/RequestGroup.cc
|
||||
* src/RequestGroup.h
|
||||
* src/RequestGroupMan.cc
|
||||
* src/RequestGroupMan.h
|
||||
* src/RequestSlot.cc
|
||||
* src/RequestSlot.h
|
||||
* src/SegmentMan.cc
|
||||
* src/SegmentMan.h
|
||||
* src/SelectEventPoll.cc
|
||||
* src/SelectEventPoll.h
|
||||
* src/ServerStat.cc
|
||||
* src/ServerStat.h
|
||||
* src/Signature.cc
|
||||
* src/Signature.h
|
||||
* src/URIResult.cc
|
||||
* src/URIResult.h
|
||||
* src/UTPexExtensionMessage.cc
|
||||
* src/UTPexExtensionMessage.h
|
||||
|
||||
2009-05-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||
|
||||
Fixed compile error without BitTorrent and Metalink support.
|
||||
|
|
|
@ -46,19 +46,9 @@ void AbstractAuthResolver::setUserDefinedAuthConfig(const AuthConfigHandle& auth
|
|||
_userDefinedAuthConfig = authConfig;
|
||||
}
|
||||
|
||||
AuthConfigHandle AbstractAuthResolver::getUserDefinedAuthConfig() const
|
||||
{
|
||||
return _userDefinedAuthConfig;
|
||||
}
|
||||
|
||||
void AbstractAuthResolver::setDefaultAuthConfig(const AuthConfigHandle& authConfig)
|
||||
{
|
||||
_defaultAuthConfig = authConfig;
|
||||
}
|
||||
|
||||
AuthConfigHandle AbstractAuthResolver::getDefaultAuthConfig() const
|
||||
{
|
||||
return _defaultAuthConfig;
|
||||
}
|
||||
|
||||
} // namespace aria2
|
||||
|
|
|
@ -53,11 +53,18 @@ public:
|
|||
|
||||
void setUserDefinedAuthConfig(const SharedHandle<AuthConfig>& authConfig);
|
||||
|
||||
SharedHandle<AuthConfig> getUserDefinedAuthConfig() const;
|
||||
const SharedHandle<AuthConfig>& getUserDefinedAuthConfig() const
|
||||
{
|
||||
return _userDefinedAuthConfig;
|
||||
}
|
||||
|
||||
void setDefaultAuthConfig(const SharedHandle<AuthConfig>& authConfig);
|
||||
|
||||
SharedHandle<AuthConfig> getDefaultAuthConfig() const;
|
||||
const SharedHandle<AuthConfig>& getDefaultAuthConfig() const
|
||||
{
|
||||
return _defaultAuthConfig;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
typedef SharedHandle<AbstractAuthResolver> AbstractAuthResolverHandle;
|
||||
|
|
|
@ -54,11 +54,6 @@ AbstractBtMessage::AbstractBtMessage(uint8_t id, const std::string& name):
|
|||
|
||||
AbstractBtMessage::~AbstractBtMessage() {}
|
||||
|
||||
SharedHandle<Peer> AbstractBtMessage::getPeer() const
|
||||
{
|
||||
return peer;
|
||||
}
|
||||
|
||||
void AbstractBtMessage::setPeer(const SharedHandle<Peer>& peer)
|
||||
{
|
||||
this->peer = peer;
|
||||
|
@ -78,21 +73,11 @@ AbstractBtMessage::setBtMessageValidator(const SharedHandle<BtMessageValidator>&
|
|||
this->validator = validator;
|
||||
}
|
||||
|
||||
SharedHandle<BtMessageValidator> AbstractBtMessage::getBtMessageValidator() const
|
||||
{
|
||||
return validator;
|
||||
}
|
||||
|
||||
void AbstractBtMessage::setBtContext(const SharedHandle<BtContext>& btContext)
|
||||
{
|
||||
this->btContext = btContext;
|
||||
}
|
||||
|
||||
SharedHandle<BtContext> AbstractBtMessage::getBtContext() const
|
||||
{
|
||||
return btContext;
|
||||
}
|
||||
|
||||
void AbstractBtMessage::setPieceStorage(const SharedHandle<PieceStorage>& pieceStorage)
|
||||
{
|
||||
this->pieceStorage = pieceStorage;
|
||||
|
@ -118,9 +103,4 @@ void AbstractBtMessage::setBtRequestFactory(const WeakHandle<BtRequestFactory>&
|
|||
this->requestFactory = factory;
|
||||
}
|
||||
|
||||
const std::string& AbstractBtMessage::getName() const
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
} // namespace aria2
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#define _D_ABSTRACT_BT_MESSAGE_H_
|
||||
|
||||
#include "BtMessage.h"
|
||||
|
||||
#include <deque>
|
||||
|
||||
namespace aria2 {
|
||||
|
@ -113,7 +114,10 @@ public:
|
|||
this->cuid = cuid;
|
||||
}
|
||||
|
||||
SharedHandle<Peer> getPeer() const;
|
||||
const SharedHandle<Peer>& getPeer() const
|
||||
{
|
||||
return peer;
|
||||
}
|
||||
|
||||
void setPeer(const SharedHandle<Peer>& peer);
|
||||
|
||||
|
@ -133,11 +137,12 @@ public:
|
|||
|
||||
void setBtMessageValidator(const SharedHandle<BtMessageValidator>& validator);
|
||||
|
||||
SharedHandle<BtMessageValidator> getBtMessageValidator() const;
|
||||
|
||||
void setBtContext(const SharedHandle<BtContext>& btContext);
|
||||
|
||||
SharedHandle<BtContext> getBtContext() const;
|
||||
const SharedHandle<BtContext>& getBtContext() const
|
||||
{
|
||||
return btContext;
|
||||
}
|
||||
|
||||
void setPieceStorage(const SharedHandle<PieceStorage>& pieceStorage);
|
||||
|
||||
|
@ -149,7 +154,10 @@ public:
|
|||
|
||||
void setBtRequestFactory(const WeakHandle<BtRequestFactory>& factory);
|
||||
|
||||
const std::string& getName() const;
|
||||
const std::string& getName() const
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
};
|
||||
|
||||
typedef SharedHandle<AbstractBtMessage> AbstractBtMessageHandle;
|
||||
|
|
|
@ -143,19 +143,9 @@ void AbstractSingleDiskAdaptor::setDiskWriter(const DiskWriterHandle& diskWriter
|
|||
this->diskWriter = diskWriter;
|
||||
}
|
||||
|
||||
DiskWriterHandle AbstractSingleDiskAdaptor::getDiskWriter() const
|
||||
{
|
||||
return diskWriter;
|
||||
}
|
||||
|
||||
void AbstractSingleDiskAdaptor::setTotalLength(const uint64_t& totalLength)
|
||||
{
|
||||
this->totalLength = totalLength;
|
||||
}
|
||||
|
||||
uint64_t AbstractSingleDiskAdaptor::getTotalLength() const
|
||||
{
|
||||
return totalLength;
|
||||
}
|
||||
|
||||
} // namespace aria2
|
||||
|
|
|
@ -91,11 +91,17 @@ public:
|
|||
|
||||
void setDiskWriter(const SharedHandle<DiskWriter>& diskWriter);
|
||||
|
||||
SharedHandle<DiskWriter> getDiskWriter() const;
|
||||
const SharedHandle<DiskWriter>& getDiskWriter() const
|
||||
{
|
||||
return diskWriter;
|
||||
}
|
||||
|
||||
void setTotalLength(const uint64_t& totalLength);
|
||||
|
||||
uint64_t getTotalLength() const;
|
||||
uint64_t getTotalLength() const
|
||||
{
|
||||
return totalLength;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace aria2
|
||||
|
|
|
@ -81,21 +81,6 @@ void AsyncNameResolver::resolve(const std::string& name)
|
|||
ares_gethostbyname(channel, name.c_str(), AF_INET, callback, this);
|
||||
}
|
||||
|
||||
const std::deque<std::string>& AsyncNameResolver::getResolvedAddresses() const
|
||||
{
|
||||
return _resolvedAddresses;
|
||||
}
|
||||
|
||||
const std::string& AsyncNameResolver::getError() const
|
||||
{
|
||||
return error;
|
||||
}
|
||||
|
||||
AsyncNameResolver::STATUS AsyncNameResolver::getStatus() const
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
int AsyncNameResolver::getFds(fd_set* rfdsPtr, fd_set* wfdsPtr) const
|
||||
{
|
||||
return ares_fds(channel, rfdsPtr, wfdsPtr);
|
||||
|
@ -135,9 +120,4 @@ void AsyncNameResolver::reset()
|
|||
ares_init(&channel);
|
||||
}
|
||||
|
||||
const std::string& AsyncNameResolver::getHostname() const
|
||||
{
|
||||
return _hostname;
|
||||
}
|
||||
|
||||
} // namespace aria2
|
||||
|
|
|
@ -79,11 +79,20 @@ public:
|
|||
|
||||
void resolve(const std::string& name);
|
||||
|
||||
const std::deque<std::string>& getResolvedAddresses() const;
|
||||
const std::deque<std::string>& getResolvedAddresses() const
|
||||
{
|
||||
return _resolvedAddresses;
|
||||
}
|
||||
|
||||
const std::string& getError() const;
|
||||
const std::string& getError() const
|
||||
{
|
||||
return error;
|
||||
}
|
||||
|
||||
STATUS getStatus() const;
|
||||
STATUS getStatus() const
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
int getFds(fd_set* rfdsPtr, fd_set* wfdsPtr) const;
|
||||
|
||||
|
@ -103,7 +112,11 @@ public:
|
|||
|
||||
void reset();
|
||||
|
||||
const std::string& getHostname() const;
|
||||
const std::string& getHostname() const
|
||||
{
|
||||
return _hostname;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
} // namespace aria2
|
||||
|
|
20
src/BNode.cc
20
src/BNode.cc
|
@ -52,26 +52,6 @@ BNode::~BNode()
|
|||
delete _right;
|
||||
}
|
||||
|
||||
SharedHandle<DHTBucket> BNode::getBucket() const
|
||||
{
|
||||
return _bucket;
|
||||
}
|
||||
|
||||
BNode* BNode::getLeft() const
|
||||
{
|
||||
return _left;
|
||||
}
|
||||
|
||||
BNode* BNode::getRight() const
|
||||
{
|
||||
return _right;
|
||||
}
|
||||
|
||||
BNode* BNode::getUp() const
|
||||
{
|
||||
return _up;
|
||||
}
|
||||
|
||||
void BNode::setLeft(BNode* left)
|
||||
{
|
||||
_left = left;
|
||||
|
|
20
src/BNode.h
20
src/BNode.h
|
@ -59,19 +59,31 @@ public:
|
|||
|
||||
~BNode();
|
||||
|
||||
SharedHandle<DHTBucket> getBucket() const;
|
||||
const SharedHandle<DHTBucket>& getBucket() const
|
||||
{
|
||||
return _bucket;
|
||||
}
|
||||
|
||||
void setBucket(const SharedHandle<DHTBucket>& bucket);
|
||||
|
||||
BNode* getLeft() const;
|
||||
BNode* getLeft() const
|
||||
{
|
||||
return _left;
|
||||
}
|
||||
|
||||
void setLeft(BNode* left);
|
||||
|
||||
BNode* getRight() const;
|
||||
BNode* getRight() const
|
||||
{
|
||||
return _right;
|
||||
}
|
||||
|
||||
void setRight(BNode* right);
|
||||
|
||||
BNode* getUp() const;
|
||||
BNode* getUp() const
|
||||
{
|
||||
return _up;
|
||||
}
|
||||
|
||||
void setUp(BNode* up);
|
||||
|
||||
|
|
|
@ -142,16 +142,6 @@ BitfieldMan::~BitfieldMan() {
|
|||
delete [] filterBitfield;
|
||||
}
|
||||
|
||||
size_t BitfieldMan::getBlockLength() const
|
||||
{
|
||||
return blockLength;
|
||||
}
|
||||
|
||||
size_t BitfieldMan::getLastBlockLength() const
|
||||
{
|
||||
return totalLength-blockLength*(blocks-1);
|
||||
}
|
||||
|
||||
size_t BitfieldMan::getBlockLength(size_t index) const
|
||||
{
|
||||
if(index == blocks-1) {
|
||||
|
@ -452,14 +442,6 @@ size_t BitfieldMan::countMissingBlockNow() const {
|
|||
}
|
||||
}
|
||||
|
||||
size_t BitfieldMan::countFilteredBlock() const {
|
||||
return cachedNumFilteredBlock;
|
||||
}
|
||||
|
||||
size_t BitfieldMan::countBlock() const {
|
||||
return blocks;
|
||||
}
|
||||
|
||||
size_t BitfieldMan::countFilteredBlockNow() const {
|
||||
if(filterEnabled) {
|
||||
return bitfield::countSetBit(filterBitfield, blocks);
|
||||
|
@ -468,11 +450,6 @@ size_t BitfieldMan::countFilteredBlockNow() const {
|
|||
}
|
||||
}
|
||||
|
||||
size_t BitfieldMan::getMaxIndex() const
|
||||
{
|
||||
return blocks-1;
|
||||
}
|
||||
|
||||
bool BitfieldMan::setBitInternal(unsigned char* bitfield, size_t index, bool on) {
|
||||
if(blocks <= index) { return false; }
|
||||
unsigned char mask = 128 >> index%8;
|
||||
|
@ -552,16 +529,6 @@ void BitfieldMan::setBitfield(const unsigned char* bitfield, size_t bitfieldLeng
|
|||
updateCache();
|
||||
}
|
||||
|
||||
const unsigned char* BitfieldMan::getBitfield() const
|
||||
{
|
||||
return bitfield;
|
||||
}
|
||||
|
||||
size_t BitfieldMan::getBitfieldLength() const
|
||||
{
|
||||
return bitfieldLength;
|
||||
}
|
||||
|
||||
void BitfieldMan::clearAllBit() {
|
||||
memset(this->bitfield, 0, this->bitfieldLength);
|
||||
updateCache();
|
||||
|
@ -627,14 +594,6 @@ void BitfieldMan::clearFilter() {
|
|||
updateCache();
|
||||
}
|
||||
|
||||
bool BitfieldMan::isFilterEnabled() const {
|
||||
return filterEnabled;
|
||||
}
|
||||
|
||||
uint64_t BitfieldMan::getFilteredTotalLength() const {
|
||||
return cachedFilteredTotalLength;
|
||||
}
|
||||
|
||||
uint64_t BitfieldMan::getFilteredTotalLengthNow() const {
|
||||
if(!filterBitfield) {
|
||||
return 0;
|
||||
|
@ -677,18 +636,10 @@ uint64_t BitfieldMan::getCompletedLength(bool useFilter) const {
|
|||
return completedLength;
|
||||
}
|
||||
|
||||
uint64_t BitfieldMan::getCompletedLength() const {
|
||||
return cachedCompletedLength;
|
||||
}
|
||||
|
||||
uint64_t BitfieldMan::getCompletedLengthNow() const {
|
||||
return getCompletedLength(false);
|
||||
}
|
||||
|
||||
uint64_t BitfieldMan::getFilteredCompletedLength() const {
|
||||
return cachedFilteredComletedLength;
|
||||
}
|
||||
|
||||
uint64_t BitfieldMan::getFilteredCompletedLengthNow() const {
|
||||
return getCompletedLength(true);
|
||||
}
|
||||
|
@ -769,9 +720,4 @@ void BitfieldMan::setRandomizer(const SharedHandle<Randomizer>& randomizer)
|
|||
this->randomizer = randomizer;
|
||||
}
|
||||
|
||||
SharedHandle<Randomizer> BitfieldMan::getRandomizer() const
|
||||
{
|
||||
return randomizer;
|
||||
}
|
||||
|
||||
} // namespace aria2
|
||||
|
|
|
@ -111,9 +111,15 @@ public:
|
|||
|
||||
BitfieldMan& operator=(const BitfieldMan& bitfieldMan);
|
||||
|
||||
size_t getBlockLength() const;
|
||||
size_t getBlockLength() const
|
||||
{
|
||||
return blockLength;
|
||||
}
|
||||
|
||||
size_t getLastBlockLength() const;
|
||||
size_t getLastBlockLength() const
|
||||
{
|
||||
return totalLength-blockLength*(blocks-1);
|
||||
}
|
||||
|
||||
size_t getBlockLength(size_t index) const;
|
||||
|
||||
|
@ -195,22 +201,38 @@ public:
|
|||
|
||||
bool isAllBitSet() const;
|
||||
|
||||
const unsigned char* getBitfield() const;
|
||||
const unsigned char* getBitfield() const
|
||||
{
|
||||
return bitfield;
|
||||
}
|
||||
|
||||
size_t getBitfieldLength() const;
|
||||
size_t getBitfieldLength() const
|
||||
{
|
||||
return bitfieldLength;
|
||||
}
|
||||
|
||||
/**
|
||||
* affected by filter
|
||||
*/
|
||||
size_t countFilteredBlock() const;
|
||||
size_t countFilteredBlock() const
|
||||
{
|
||||
return cachedNumFilteredBlock;
|
||||
}
|
||||
|
||||
size_t countBlock() const
|
||||
{
|
||||
return blocks;
|
||||
}
|
||||
|
||||
size_t countBlock() const;
|
||||
/**
|
||||
* affected by filter
|
||||
*/
|
||||
size_t countFilteredBlockNow() const;
|
||||
|
||||
size_t getMaxIndex() const;
|
||||
size_t getMaxIndex() const
|
||||
{
|
||||
return blocks-1;
|
||||
}
|
||||
|
||||
void setBitfield(const unsigned char* bitfield, size_t bitfieldLength);
|
||||
|
||||
|
@ -228,24 +250,38 @@ public:
|
|||
|
||||
void enableFilter();
|
||||
void disableFilter();
|
||||
bool isFilterEnabled() const;
|
||||
bool isFilterEnabled() const
|
||||
{
|
||||
return filterEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* affected by filter
|
||||
*/
|
||||
uint64_t getFilteredTotalLength() const;
|
||||
uint64_t getFilteredTotalLength() const
|
||||
{
|
||||
return cachedFilteredTotalLength;
|
||||
}
|
||||
|
||||
/**
|
||||
* affected by filter
|
||||
*/
|
||||
uint64_t getFilteredTotalLengthNow() const;
|
||||
|
||||
uint64_t getCompletedLength() const;
|
||||
uint64_t getCompletedLength() const
|
||||
{
|
||||
return cachedCompletedLength;
|
||||
}
|
||||
|
||||
uint64_t getCompletedLengthNow() const;
|
||||
|
||||
/**
|
||||
* affected by filter
|
||||
*/
|
||||
uint64_t getFilteredCompletedLength() const;
|
||||
uint64_t getFilteredCompletedLength() const
|
||||
{
|
||||
return cachedFilteredComletedLength;
|
||||
}
|
||||
/**
|
||||
* affected by filter
|
||||
*/
|
||||
|
@ -253,7 +289,10 @@ public:
|
|||
|
||||
void setRandomizer(const SharedHandle<Randomizer>& randomizer);
|
||||
|
||||
SharedHandle<Randomizer> getRandomizer() const;
|
||||
const SharedHandle<Randomizer>& getRandomizer() const
|
||||
{
|
||||
return randomizer;
|
||||
}
|
||||
|
||||
void updateCache();
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ public:
|
|||
BtAbortOutstandingRequestEvent(const SharedHandle<Piece>& piece):
|
||||
piece(piece) {}
|
||||
|
||||
SharedHandle<Piece> getPiece() const { return piece; }
|
||||
const SharedHandle<Piece>& getPiece() const { return piece; }
|
||||
};
|
||||
|
||||
} // namespace aria2
|
||||
|
|
|
@ -116,9 +116,4 @@ void BtExtendedMessage::doReceivedAction()
|
|||
}
|
||||
}
|
||||
|
||||
ExtensionMessageHandle BtExtendedMessage::getExtensionMessage() const
|
||||
{
|
||||
return _extensionMessage;
|
||||
}
|
||||
|
||||
} // namespace aria2
|
||||
|
|
|
@ -78,7 +78,11 @@ public:
|
|||
|
||||
virtual std::string toString() const;
|
||||
|
||||
SharedHandle<ExtensionMessage> getExtensionMessage() const;
|
||||
const SharedHandle<ExtensionMessage>& getExtensionMessage() const
|
||||
{
|
||||
return _extensionMessage;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
} // namespace aria2
|
||||
|
|
|
@ -77,16 +77,6 @@ BtSeederStateChoke::PeerEntry::operator<(const PeerEntry& rhs) const
|
|||
}
|
||||
}
|
||||
|
||||
SharedHandle<Peer> BtSeederStateChoke::PeerEntry::getPeer() const
|
||||
{
|
||||
return _peer;
|
||||
}
|
||||
|
||||
unsigned int BtSeederStateChoke::PeerEntry::getUploadSpeed() const
|
||||
{
|
||||
return _uploadSpeed;
|
||||
}
|
||||
|
||||
void BtSeederStateChoke::PeerEntry::disableOptUnchoking()
|
||||
{
|
||||
_peer->optUnchoking(false);
|
||||
|
@ -173,9 +163,4 @@ BtSeederStateChoke::executeChoke(const std::deque<SharedHandle<Peer> >& peerSet)
|
|||
}
|
||||
}
|
||||
|
||||
const Time& BtSeederStateChoke::getLastRound() const
|
||||
{
|
||||
return _lastRound;
|
||||
}
|
||||
|
||||
} // namespace aria2
|
||||
|
|
|
@ -69,9 +69,9 @@ private:
|
|||
|
||||
bool operator<(const PeerEntry& rhs) const;
|
||||
|
||||
SharedHandle<Peer> getPeer() const;
|
||||
const SharedHandle<Peer>& getPeer() const { return _peer; }
|
||||
|
||||
unsigned int getUploadSpeed() const;
|
||||
unsigned int getUploadSpeed() const { return _uploadSpeed; }
|
||||
|
||||
void disableOptUnchoking();
|
||||
};
|
||||
|
@ -87,7 +87,7 @@ public:
|
|||
|
||||
void executeChoke(const std::deque<SharedHandle<Peer> >& peerSet);
|
||||
|
||||
const Time& getLastRound() const;
|
||||
const Time& getLastRound() const { return _lastRound; }
|
||||
};
|
||||
|
||||
} // namespace aria2
|
||||
|
|
|
@ -206,41 +206,6 @@ bool Cookie::isExpired() const
|
|||
return !_expiry == 0 && Time().getTime() >= _expiry;
|
||||
}
|
||||
|
||||
const std::string& Cookie::getName() const
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
const std::string& Cookie::getValue() const
|
||||
{
|
||||
return _value;
|
||||
}
|
||||
|
||||
const std::string& Cookie::getPath() const
|
||||
{
|
||||
return _path;
|
||||
}
|
||||
|
||||
const std::string& Cookie::getDomain() const
|
||||
{
|
||||
return _domain;
|
||||
}
|
||||
|
||||
time_t Cookie::getExpiry() const
|
||||
{
|
||||
return _expiry;
|
||||
}
|
||||
|
||||
bool Cookie::isSecureCookie() const
|
||||
{
|
||||
return _secure;
|
||||
}
|
||||
|
||||
bool Cookie::isSessionCookie() const
|
||||
{
|
||||
return _expiry == 0;
|
||||
}
|
||||
|
||||
std::string Cookie::toNsCookieFormat() const
|
||||
{
|
||||
std::stringstream ss;
|
||||
|
|
35
src/Cookie.h
35
src/Cookie.h
|
@ -91,19 +91,40 @@ public:
|
|||
|
||||
bool isExpired() const;
|
||||
|
||||
const std::string& getName() const;
|
||||
const std::string& getName() const
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
const std::string& getValue() const;
|
||||
const std::string& getValue() const
|
||||
{
|
||||
return _value;
|
||||
}
|
||||
|
||||
const std::string& getPath() const;
|
||||
const std::string& getPath() const
|
||||
{
|
||||
return _path;
|
||||
}
|
||||
|
||||
const std::string& getDomain() const;
|
||||
const std::string& getDomain() const
|
||||
{
|
||||
return _domain;
|
||||
}
|
||||
|
||||
time_t getExpiry() const;
|
||||
time_t getExpiry() const
|
||||
{
|
||||
return _expiry;
|
||||
}
|
||||
|
||||
bool isSecureCookie() const;
|
||||
bool isSecureCookie() const
|
||||
{
|
||||
return _secure;
|
||||
}
|
||||
|
||||
bool isSessionCookie() const;
|
||||
bool isSessionCookie() const
|
||||
{
|
||||
return _expiry == 0;
|
||||
}
|
||||
|
||||
std::string toNsCookieFormat() const;
|
||||
};
|
||||
|
|
|
@ -212,16 +212,6 @@ SharedHandle<DHTBucket> DHTBucket::split()
|
|||
return rBucket;
|
||||
}
|
||||
|
||||
size_t DHTBucket::countNode() const
|
||||
{
|
||||
return _nodes.size();
|
||||
}
|
||||
|
||||
const std::deque<SharedHandle<DHTNode> >& DHTBucket::getNodes() const
|
||||
{
|
||||
return _nodes;
|
||||
}
|
||||
|
||||
void DHTBucket::getGoodNodes(std::deque<SharedHandle<DHTNode> >& goodNodes) const
|
||||
{
|
||||
goodNodes = _nodes;
|
||||
|
@ -283,9 +273,4 @@ SharedHandle<DHTNode> DHTBucket::getLRUQuestionableNode() const
|
|||
}
|
||||
}
|
||||
|
||||
const std::deque<SharedHandle<DHTNode> >& DHTBucket::getCachedNodes() const
|
||||
{
|
||||
return _cachedNodes;
|
||||
}
|
||||
|
||||
} // namespace aria2
|
||||
|
|
|
@ -113,9 +113,15 @@ public:
|
|||
return _min;
|
||||
}
|
||||
|
||||
size_t countNode() const;
|
||||
size_t countNode() const
|
||||
{
|
||||
return _nodes.size();
|
||||
}
|
||||
|
||||
const std::deque<SharedHandle<DHTNode> >& getNodes() const;
|
||||
const std::deque<SharedHandle<DHTNode> >& getNodes() const
|
||||
{
|
||||
return _nodes;
|
||||
}
|
||||
|
||||
void getGoodNodes(std::deque<SharedHandle<DHTNode> >& nodes) const;
|
||||
|
||||
|
@ -139,7 +145,11 @@ public:
|
|||
|
||||
SharedHandle<DHTNode> getLRUQuestionableNode() const;
|
||||
|
||||
const std::deque<SharedHandle<DHTNode> >& getCachedNodes() const;
|
||||
const std::deque<SharedHandle<DHTNode> >& getCachedNodes() const
|
||||
{
|
||||
return _cachedNodes;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
} // namespace aria2
|
||||
|
|
|
@ -107,9 +107,4 @@ ssize_t DHTConnectionImpl::sendMessage(const unsigned char* data, size_t len,
|
|||
return _socket->writeData(data, len, host, port);
|
||||
}
|
||||
|
||||
SharedHandle<SocketCore> DHTConnectionImpl::getSocket() const
|
||||
{
|
||||
return _socket;
|
||||
}
|
||||
|
||||
} // namespace aria2
|
||||
|
|
|
@ -77,7 +77,10 @@ public:
|
|||
virtual ssize_t sendMessage(const unsigned char* data, size_t len,
|
||||
const std::string& host, uint16_t port);
|
||||
|
||||
SharedHandle<SocketCore> getSocket() const;
|
||||
const SharedHandle<SocketCore>& getSocket() const
|
||||
{
|
||||
return _socket;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace aria2
|
||||
|
|
|
@ -96,11 +96,6 @@ std::string DHTFindNodeReplyMessage::getMessageType() const
|
|||
|
||||
void DHTFindNodeReplyMessage::validate() const {}
|
||||
|
||||
const std::deque<SharedHandle<DHTNode> >& DHTFindNodeReplyMessage::getClosestKNodes() const
|
||||
{
|
||||
return _closestKNodes;
|
||||
}
|
||||
|
||||
void DHTFindNodeReplyMessage::setClosestKNodes(const std::deque<SharedHandle<DHTNode> >& closestKNodes)
|
||||
{
|
||||
_closestKNodes = closestKNodes;
|
||||
|
|
|
@ -60,7 +60,10 @@ public:
|
|||
|
||||
virtual void validate() const;
|
||||
|
||||
const std::deque<SharedHandle<DHTNode> >& getClosestKNodes() const;
|
||||
const std::deque<SharedHandle<DHTNode> >& getClosestKNodes() const
|
||||
{
|
||||
return _closestKNodes;
|
||||
}
|
||||
|
||||
void setClosestKNodes(const std::deque<SharedHandle<DHTNode> >& closestKNodes);
|
||||
|
||||
|
|
|
@ -112,21 +112,11 @@ std::string DHTGetPeersReplyMessage::getMessageType() const
|
|||
|
||||
void DHTGetPeersReplyMessage::validate() const {}
|
||||
|
||||
const std::deque<SharedHandle<DHTNode> >& DHTGetPeersReplyMessage::getClosestKNodes() const
|
||||
{
|
||||
return _closestKNodes;
|
||||
}
|
||||
|
||||
void DHTGetPeersReplyMessage::setClosestKNodes(const std::deque<SharedHandle<DHTNode> >& closestKNodes)
|
||||
{
|
||||
_closestKNodes = closestKNodes;
|
||||
}
|
||||
|
||||
const std::deque<SharedHandle<Peer> >& DHTGetPeersReplyMessage::getValues() const
|
||||
{
|
||||
return _values;
|
||||
}
|
||||
|
||||
void DHTGetPeersReplyMessage::setValues(const std::deque<SharedHandle<Peer> >& peers)
|
||||
{
|
||||
_values = peers;
|
||||
|
|
|
@ -70,9 +70,15 @@ public:
|
|||
|
||||
virtual void validate() const;
|
||||
|
||||
const std::deque<SharedHandle<DHTNode> >& getClosestKNodes() const;
|
||||
const std::deque<SharedHandle<DHTNode> >& getClosestKNodes() const
|
||||
{
|
||||
return _closestKNodes;
|
||||
}
|
||||
|
||||
const std::deque<SharedHandle<Peer> >& getValues() const;
|
||||
const std::deque<SharedHandle<Peer> >& getValues() const
|
||||
{
|
||||
return _values;
|
||||
}
|
||||
|
||||
void setClosestKNodes(const std::deque<SharedHandle<DHTNode> >& closestKNodes);
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include "RequestGroupMan.h"
|
||||
#include "Logger.h"
|
||||
#include "DHTMessageCallback.h"
|
||||
#include "DHTNode.h"
|
||||
|
||||
namespace aria2 {
|
||||
|
||||
|
|
|
@ -63,14 +63,4 @@ void DHTMessage::generateTransactionID()
|
|||
_transactionID = std::string(&tid[0], &tid[DHT_TRANSACTION_ID_LENGTH]);
|
||||
}
|
||||
|
||||
SharedHandle<DHTNode> DHTMessage::getLocalNode() const
|
||||
{
|
||||
return _localNode;
|
||||
}
|
||||
|
||||
SharedHandle<DHTNode> DHTMessage::getRemoteNode() const
|
||||
{
|
||||
return _remoteNode;
|
||||
}
|
||||
|
||||
} // namespace aria2
|
||||
|
|
|
@ -67,9 +67,15 @@ public:
|
|||
return _transactionID;
|
||||
}
|
||||
|
||||
SharedHandle<DHTNode> getLocalNode() const;
|
||||
const SharedHandle<DHTNode>& getLocalNode() const
|
||||
{
|
||||
return _localNode;
|
||||
}
|
||||
|
||||
SharedHandle<DHTNode> getRemoteNode() const;
|
||||
const SharedHandle<DHTNode>& getRemoteNode() const
|
||||
{
|
||||
return _remoteNode;
|
||||
}
|
||||
|
||||
virtual void doReceivedAction() = 0;
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include "Logger.h"
|
||||
#include "DHTConstants.h"
|
||||
#include "StringFormat.h"
|
||||
#include "DHTNode.h"
|
||||
|
||||
namespace aria2 {
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "DHTMessageEntry.h"
|
||||
#include "DHTMessage.h"
|
||||
#include "DHTMessageCallback.h"
|
||||
#include "DHTNode.h"
|
||||
|
||||
namespace aria2 {
|
||||
|
||||
|
|
|
@ -143,16 +143,6 @@ DHTMessageReceiver::handleUnknownMessage(const unsigned char* data,
|
|||
return m;
|
||||
}
|
||||
|
||||
SharedHandle<DHTConnection> DHTMessageReceiver::getConnection() const
|
||||
{
|
||||
return _connection;
|
||||
}
|
||||
|
||||
SharedHandle<DHTMessageTracker> DHTMessageReceiver::getMessageTracker() const
|
||||
{
|
||||
return _tracker;
|
||||
}
|
||||
|
||||
void DHTMessageReceiver::setConnection(const SharedHandle<DHTConnection>& connection)
|
||||
{
|
||||
_connection = connection;
|
||||
|
|
|
@ -72,9 +72,15 @@ public:
|
|||
|
||||
void handleTimeout();
|
||||
|
||||
SharedHandle<DHTConnection> getConnection() const;
|
||||
const SharedHandle<DHTConnection>& getConnection() const
|
||||
{
|
||||
return _connection;
|
||||
}
|
||||
|
||||
SharedHandle<DHTMessageTracker> getMessageTracker() const;
|
||||
const SharedHandle<DHTMessageTracker>& getMessageTracker() const
|
||||
{
|
||||
return _tracker;
|
||||
}
|
||||
|
||||
void setConnection(const SharedHandle<DHTConnection>& connection);
|
||||
|
||||
|
|
|
@ -75,14 +75,4 @@ bool DHTMessageTrackerEntry::match(const std::string& transactionID, const std::
|
|||
return false;
|
||||
}
|
||||
|
||||
SharedHandle<DHTMessageCallback> DHTMessageTrackerEntry::getCallback() const
|
||||
{
|
||||
return _callback;
|
||||
}
|
||||
|
||||
SharedHandle<DHTNode> DHTMessageTrackerEntry::getTargetNode() const
|
||||
{
|
||||
return _targetNode;
|
||||
}
|
||||
|
||||
} // namespace aria2
|
||||
|
|
|
@ -72,14 +72,20 @@ public:
|
|||
|
||||
bool match(const std::string& transactionID, const std::string& ipaddr, uint16_t port) const;
|
||||
|
||||
SharedHandle<DHTNode> getTargetNode() const;
|
||||
const SharedHandle<DHTNode>& getTargetNode() const
|
||||
{
|
||||
return _targetNode;
|
||||
}
|
||||
|
||||
const std::string& getMessageType() const
|
||||
{
|
||||
return _messageType;
|
||||
}
|
||||
|
||||
SharedHandle<DHTMessageCallback> getCallback() const;
|
||||
const SharedHandle<DHTMessageCallback>& getCallback() const
|
||||
{
|
||||
return _callback;
|
||||
}
|
||||
|
||||
int64_t getElapsedMillis() const
|
||||
{
|
||||
|
|
|
@ -76,11 +76,6 @@ size_t DHTPeerAnnounceEntry::countPeerAddrEntry() const
|
|||
return _peerAddrEntries.size();
|
||||
}
|
||||
|
||||
const std::deque<PeerAddrEntry>& DHTPeerAnnounceEntry::getPeerAddrEntries() const
|
||||
{
|
||||
return _peerAddrEntries;
|
||||
}
|
||||
|
||||
class FindStaleEntry {
|
||||
private:
|
||||
time_t _timeout;
|
||||
|
|
|
@ -73,7 +73,10 @@ public:
|
|||
|
||||
size_t countPeerAddrEntry() const;
|
||||
|
||||
const std::deque<PeerAddrEntry>& getPeerAddrEntries() const;
|
||||
const std::deque<PeerAddrEntry>& getPeerAddrEntries() const
|
||||
{
|
||||
return _peerAddrEntries;
|
||||
}
|
||||
|
||||
void removeStalePeerAddrEntry(time_t timeout);
|
||||
|
||||
|
|
|
@ -102,11 +102,6 @@ void DHTPeerLookupTask::onFinish()
|
|||
}
|
||||
}
|
||||
|
||||
const std::deque<SharedHandle<Peer> >& DHTPeerLookupTask::getPeers() const
|
||||
{
|
||||
return _peers;
|
||||
}
|
||||
|
||||
void DHTPeerLookupTask::setBtRuntime(const SharedHandle<BtRuntime>& btRuntime)
|
||||
{
|
||||
_btRuntime = btRuntime;
|
||||
|
|
|
@ -68,7 +68,10 @@ public:
|
|||
|
||||
virtual void onFinish();
|
||||
|
||||
const std::deque<SharedHandle<Peer> >& getPeers() const;
|
||||
const std::deque<SharedHandle<Peer> >& getPeers() const
|
||||
{
|
||||
return _peers;
|
||||
}
|
||||
|
||||
void setBtRuntime(const SharedHandle<BtRuntime>& btRuntime);
|
||||
|
||||
|
|
|
@ -56,16 +56,6 @@ DHTRoutingTableDeserializer::DHTRoutingTableDeserializer() {}
|
|||
|
||||
DHTRoutingTableDeserializer::~DHTRoutingTableDeserializer() {}
|
||||
|
||||
SharedHandle<DHTNode> DHTRoutingTableDeserializer::getLocalNode() const
|
||||
{
|
||||
return _localNode;
|
||||
}
|
||||
|
||||
const std::deque<SharedHandle<DHTNode> >& DHTRoutingTableDeserializer::getNodes() const
|
||||
{
|
||||
return _nodes;
|
||||
}
|
||||
|
||||
static std::istream& readBytes(unsigned char* buf, size_t buflen,
|
||||
std::istream& in, size_t readlen)
|
||||
{
|
||||
|
|
|
@ -57,9 +57,15 @@ public:
|
|||
|
||||
~DHTRoutingTableDeserializer();
|
||||
|
||||
SharedHandle<DHTNode> getLocalNode() const;
|
||||
const SharedHandle<DHTNode>& getLocalNode() const
|
||||
{
|
||||
return _localNode;
|
||||
}
|
||||
|
||||
const std::deque<SharedHandle<DHTNode> >& getNodes() const;
|
||||
const std::deque<SharedHandle<DHTNode> >& getNodes() const
|
||||
{
|
||||
return _nodes;
|
||||
}
|
||||
|
||||
Time getSerializedTime() const
|
||||
{
|
||||
|
|
|
@ -281,31 +281,16 @@ void DefaultBtAnnounce::setBtRuntime(const BtRuntimeHandle& btRuntime)
|
|||
this->btRuntime = btRuntime;
|
||||
}
|
||||
|
||||
BtRuntimeHandle DefaultBtAnnounce::getBtRuntime() const
|
||||
{
|
||||
return btRuntime;
|
||||
}
|
||||
|
||||
void DefaultBtAnnounce::setPieceStorage(const PieceStorageHandle& pieceStorage)
|
||||
{
|
||||
this->pieceStorage = pieceStorage;
|
||||
}
|
||||
|
||||
PieceStorageHandle DefaultBtAnnounce::getPieceStorage() const
|
||||
{
|
||||
return pieceStorage;
|
||||
}
|
||||
|
||||
void DefaultBtAnnounce::setPeerStorage(const PeerStorageHandle& peerStorage)
|
||||
{
|
||||
this->peerStorage = peerStorage;
|
||||
}
|
||||
|
||||
PeerStorageHandle DefaultBtAnnounce::getPeerStorage() const
|
||||
{
|
||||
return peerStorage;
|
||||
}
|
||||
|
||||
void DefaultBtAnnounce::overrideMinInterval(time_t interval)
|
||||
{
|
||||
minInterval = interval;
|
||||
|
|
|
@ -76,15 +76,24 @@ public:
|
|||
|
||||
void setBtRuntime(const SharedHandle<BtRuntime>& btRuntime);
|
||||
|
||||
SharedHandle<BtRuntime> getBtRuntime() const;
|
||||
const SharedHandle<BtRuntime>& getBtRuntime() const
|
||||
{
|
||||
return btRuntime;
|
||||
}
|
||||
|
||||
void setPieceStorage(const SharedHandle<PieceStorage>& pieceStorage);
|
||||
|
||||
SharedHandle<PieceStorage> getPieceStorage() const;
|
||||
const SharedHandle<PieceStorage>& getPieceStorage() const
|
||||
{
|
||||
return pieceStorage;
|
||||
}
|
||||
|
||||
void setPeerStorage(const SharedHandle<PeerStorage>& peerStorage);
|
||||
|
||||
SharedHandle<PeerStorage> getPeerStorage() const;
|
||||
const SharedHandle<PeerStorage>& getPeerStorage() const
|
||||
{
|
||||
return peerStorage;
|
||||
}
|
||||
|
||||
bool isDefaultAnnounceReady();
|
||||
|
||||
|
|
|
@ -407,17 +407,6 @@ size_t DefaultBtMessageDispatcher::countOutstandingUpload()
|
|||
mem_fun_sh(&BtMessage::isUploading));
|
||||
}
|
||||
|
||||
const std::deque<SharedHandle<BtMessage> >&
|
||||
DefaultBtMessageDispatcher::getMessageQueue()
|
||||
{
|
||||
return messageQueue;
|
||||
}
|
||||
|
||||
const std::deque<RequestSlot>& DefaultBtMessageDispatcher::getRequestSlots()
|
||||
{
|
||||
return requestSlots;
|
||||
}
|
||||
|
||||
void DefaultBtMessageDispatcher::setPeer(const SharedHandle<Peer>& peer)
|
||||
{
|
||||
this->peer = peer;
|
||||
|
|
|
@ -104,9 +104,15 @@ public:
|
|||
|
||||
virtual size_t countOutstandingUpload();
|
||||
|
||||
const std::deque<SharedHandle<BtMessage> >& getMessageQueue();
|
||||
const std::deque<SharedHandle<BtMessage> >& getMessageQueue() const
|
||||
{
|
||||
return messageQueue;
|
||||
}
|
||||
|
||||
const RequestSlots& getRequestSlots();
|
||||
const RequestSlots& getRequestSlots() const
|
||||
{
|
||||
return requestSlots;
|
||||
}
|
||||
|
||||
void setPeer(const SharedHandle<Peer>& peer);
|
||||
|
||||
|
|
|
@ -235,11 +235,6 @@ void DefaultBtRequestFactory::getTargetPieceIndexes
|
|||
mem_fun_sh(&Piece::getIndex));
|
||||
}
|
||||
|
||||
std::deque<SharedHandle<Piece> >& DefaultBtRequestFactory::getTargetPieces()
|
||||
{
|
||||
return pieces;
|
||||
}
|
||||
|
||||
void DefaultBtRequestFactory::setBtContext(const SharedHandle<BtContext>& btContext)
|
||||
{
|
||||
this->btContext = btContext;
|
||||
|
|
|
@ -86,7 +86,10 @@ public:
|
|||
|
||||
virtual void getTargetPieceIndexes(std::deque<size_t>& indexes) const;
|
||||
|
||||
std::deque<SharedHandle<Piece> >& getTargetPieces();
|
||||
std::deque<SharedHandle<Piece> >& getTargetPieces()
|
||||
{
|
||||
return pieces;
|
||||
}
|
||||
|
||||
void setCuid(int32_t cuid)
|
||||
{
|
||||
|
|
|
@ -51,9 +51,4 @@ void DiskAdaptor::setFileEntries(const FileEntries& fileEntries) {
|
|||
this->fileEntries = fileEntries;
|
||||
}
|
||||
|
||||
const FileEntries& DiskAdaptor::getFileEntries() const
|
||||
{
|
||||
return fileEntries;
|
||||
}
|
||||
|
||||
} // namespace aria2
|
||||
|
|
|
@ -75,7 +75,10 @@ public:
|
|||
|
||||
void setFileEntries(const std::deque<SharedHandle<FileEntry> >& fileEntries);
|
||||
|
||||
const std::deque<SharedHandle<FileEntry> >& getFileEntries() const;
|
||||
const std::deque<SharedHandle<FileEntry> >& getFileEntries() const
|
||||
{
|
||||
return fileEntries;
|
||||
}
|
||||
|
||||
virtual SharedHandle<FileAllocationIterator> fileAllocationIterator() = 0;
|
||||
|
||||
|
|
|
@ -43,11 +43,6 @@ DownloadContext::DownloadContext():
|
|||
|
||||
DownloadContext::~DownloadContext() {}
|
||||
|
||||
const std::string& DownloadContext::getDir() const
|
||||
{
|
||||
return _dir;
|
||||
}
|
||||
|
||||
void DownloadContext::setDir(const std::string& dir)
|
||||
{
|
||||
_dir = dir;
|
||||
|
|
|
@ -97,7 +97,10 @@ public:
|
|||
*/
|
||||
virtual std::string getActualBasePath() const = 0;
|
||||
|
||||
const std::string& getDir() const;
|
||||
const std::string& getDir() const
|
||||
{
|
||||
return _dir;
|
||||
}
|
||||
|
||||
void setDir(const std::string& dir);
|
||||
|
||||
|
|
|
@ -267,11 +267,6 @@ void DownloadEngine::addRoutineCommand(Command* command)
|
|||
_routineCommands.push_back(command);
|
||||
}
|
||||
|
||||
SharedHandle<CookieStorage> DownloadEngine::getCookieStorage() const
|
||||
{
|
||||
return _cookieStorage;
|
||||
}
|
||||
|
||||
void DownloadEngine::poolSocket(const std::string& ipaddr,
|
||||
uint16_t port,
|
||||
const SocketPoolEntry& entry)
|
||||
|
@ -428,11 +423,6 @@ DownloadEngine::popPooledSocket
|
|||
return s;
|
||||
}
|
||||
|
||||
SharedHandle<BtRegistry> DownloadEngine::getBtRegistry() const
|
||||
{
|
||||
return _btRegistry;
|
||||
}
|
||||
|
||||
DownloadEngine::SocketPoolEntry::SocketPoolEntry
|
||||
(const SharedHandle<SocketCore>& socket,
|
||||
const std::map<std::string, std::string>& options,
|
||||
|
@ -448,17 +438,6 @@ bool DownloadEngine::SocketPoolEntry::isTimeout() const
|
|||
return _registeredTime.elapsed(_timeout);
|
||||
}
|
||||
|
||||
SharedHandle<SocketCore> DownloadEngine::SocketPoolEntry::getSocket() const
|
||||
{
|
||||
return _socket;
|
||||
}
|
||||
|
||||
const std::map<std::string, std::string>&
|
||||
DownloadEngine::SocketPoolEntry::getOptions() const
|
||||
{
|
||||
return _options;
|
||||
}
|
||||
|
||||
cuid_t DownloadEngine::newCUID()
|
||||
{
|
||||
return _cuidCounter.newID();
|
||||
|
@ -482,11 +461,6 @@ void DownloadEngine::setAuthConfigFactory
|
|||
_authConfigFactory = factory;
|
||||
}
|
||||
|
||||
SharedHandle<AuthConfigFactory> DownloadEngine::getAuthConfigFactory() const
|
||||
{
|
||||
return _authConfigFactory;
|
||||
}
|
||||
|
||||
void DownloadEngine::setRefreshInterval(time_t interval)
|
||||
{
|
||||
_refreshInterval = interval;
|
||||
|
|
|
@ -97,9 +97,15 @@ private:
|
|||
|
||||
bool isTimeout() const;
|
||||
|
||||
SharedHandle<SocketCore> getSocket() const;
|
||||
const SharedHandle<SocketCore>& getSocket() const
|
||||
{
|
||||
return _socket;
|
||||
}
|
||||
|
||||
const std::map<std::string, std::string>& getOptions() const;
|
||||
const std::map<std::string, std::string>& getOptions() const
|
||||
{
|
||||
return _options;
|
||||
}
|
||||
};
|
||||
|
||||
// key = IP address:port, value = SocketPoolEntry
|
||||
|
@ -226,9 +232,15 @@ public:
|
|||
const std::deque<std::string>& ipaddrs,
|
||||
uint16_t port);
|
||||
|
||||
SharedHandle<CookieStorage> getCookieStorage() const;
|
||||
const SharedHandle<CookieStorage>& getCookieStorage() const
|
||||
{
|
||||
return _cookieStorage;
|
||||
}
|
||||
|
||||
SharedHandle<BtRegistry> getBtRegistry() const;
|
||||
const SharedHandle<BtRegistry>& getBtRegistry() const
|
||||
{
|
||||
return _btRegistry;
|
||||
}
|
||||
|
||||
cuid_t newCUID();
|
||||
|
||||
|
@ -238,7 +250,10 @@ public:
|
|||
|
||||
void setAuthConfigFactory(const SharedHandle<AuthConfigFactory>& factory);
|
||||
|
||||
SharedHandle<AuthConfigFactory> getAuthConfigFactory() const;
|
||||
const SharedHandle<AuthConfigFactory>& getAuthConfigFactory() const
|
||||
{
|
||||
return _authConfigFactory;
|
||||
}
|
||||
|
||||
void setRefreshInterval(time_t interval);
|
||||
};
|
||||
|
|
|
@ -47,37 +47,11 @@ namespace aria2 {
|
|||
EpollEventPoll::CommandEvent::CommandEvent(Command* command, int events):
|
||||
_command(command), _events(events) {}
|
||||
|
||||
bool EpollEventPoll::CommandEvent::operator==
|
||||
(const CommandEvent& commandEvent) const
|
||||
{
|
||||
return _command == commandEvent._command;
|
||||
}
|
||||
|
||||
Command* EpollEventPoll::CommandEvent::getCommand() const
|
||||
{
|
||||
return _command;
|
||||
}
|
||||
|
||||
int EpollEventPoll::CommandEvent::getEvents() const
|
||||
{
|
||||
return _events;
|
||||
}
|
||||
|
||||
void EpollEventPoll::CommandEvent::addEvents(int events)
|
||||
{
|
||||
_events |= events;
|
||||
}
|
||||
|
||||
void EpollEventPoll::CommandEvent::removeEvents(int events)
|
||||
{
|
||||
_events &= (~events);
|
||||
}
|
||||
|
||||
bool EpollEventPoll::CommandEvent::eventsEmpty() const
|
||||
{
|
||||
return _events == 0;
|
||||
}
|
||||
|
||||
void EpollEventPoll::CommandEvent::processEvents(int events)
|
||||
{
|
||||
if((_events&events) ||
|
||||
|
@ -118,11 +92,6 @@ EpollEventPoll::ADNSEvent::ADNSEvent
|
|||
sock_t socket, int events):
|
||||
_resolver(resolver), _command(command), _socket(socket), _events(events) {}
|
||||
|
||||
bool EpollEventPoll::ADNSEvent::operator==(const ADNSEvent& event) const
|
||||
{
|
||||
return _resolver == event._resolver;
|
||||
}
|
||||
|
||||
int EpollEventPoll::ADNSEvent::getEvents() const
|
||||
{
|
||||
return _events;
|
||||
|
@ -167,16 +136,6 @@ EpollEventPoll::SocketEntry::SocketEntry(sock_t socket):_socket(socket)
|
|||
memset(&_epEvent, 0, sizeof(struct epoll_event));
|
||||
}
|
||||
|
||||
bool EpollEventPoll::SocketEntry::operator==(const SocketEntry& entry) const
|
||||
{
|
||||
return _socket == entry._socket;
|
||||
}
|
||||
|
||||
bool EpollEventPoll::SocketEntry::operator<(const SocketEntry& entry) const
|
||||
{
|
||||
return _socket < entry._socket;
|
||||
}
|
||||
|
||||
void EpollEventPoll::SocketEntry::addCommandEvent(const CommandEvent& cev)
|
||||
{
|
||||
std::deque<CommandEvent>::iterator i = std::find(_commandEvents.begin(),
|
||||
|
@ -247,11 +206,6 @@ void EpollEventPoll::SocketEntry::processEvents(int events)
|
|||
|
||||
}
|
||||
|
||||
sock_t EpollEventPoll::SocketEntry::getSocket() const
|
||||
{
|
||||
return _socket;
|
||||
}
|
||||
|
||||
bool EpollEventPoll::SocketEntry::eventEmpty() const
|
||||
{
|
||||
|
||||
|
@ -303,13 +257,6 @@ EpollEventPoll::AsyncNameResolverEntry::AsyncNameResolverEntry
|
|||
|
||||
{}
|
||||
|
||||
bool EpollEventPoll::AsyncNameResolverEntry::operator==
|
||||
(const AsyncNameResolverEntry& entry)
|
||||
{
|
||||
return _nameResolver == entry._nameResolver &&
|
||||
_command == entry._command;
|
||||
}
|
||||
|
||||
void EpollEventPoll::AsyncNameResolverEntry::addSocketEvents
|
||||
(EpollEventPoll* e)
|
||||
{
|
||||
|
|
|
@ -78,15 +78,30 @@ private:
|
|||
public:
|
||||
CommandEvent(Command* command, int events);
|
||||
|
||||
Command* getCommand() const;
|
||||
Command* getCommand() const
|
||||
{
|
||||
return _command;
|
||||
}
|
||||
|
||||
void addEvents(int events);
|
||||
|
||||
void removeEvents(int events);
|
||||
|
||||
bool eventsEmpty() const;
|
||||
void addEvents(int events)
|
||||
{
|
||||
_events |= events;
|
||||
}
|
||||
|
||||
void removeEvents(int events)
|
||||
{
|
||||
_events &= (~events);
|
||||
}
|
||||
|
||||
bool eventsEmpty() const
|
||||
{
|
||||
return _events == 0;
|
||||
}
|
||||
|
||||
bool operator==(const CommandEvent& event) const;
|
||||
bool operator==(const CommandEvent& commandEvent) const
|
||||
{
|
||||
return _command == commandEvent._command;
|
||||
}
|
||||
|
||||
virtual int getEvents() const;
|
||||
|
||||
|
@ -107,7 +122,10 @@ private:
|
|||
ADNSEvent(const SharedHandle<AsyncNameResolver>& resolver, Command* command,
|
||||
sock_t socket, int events);
|
||||
|
||||
bool operator==(const ADNSEvent& event) const;
|
||||
bool operator==(const ADNSEvent& event) const
|
||||
{
|
||||
return _resolver == event._resolver;
|
||||
}
|
||||
|
||||
virtual int getEvents() const;
|
||||
|
||||
|
@ -136,9 +154,15 @@ private:
|
|||
public:
|
||||
SocketEntry(sock_t socket);
|
||||
|
||||
bool operator==(const SocketEntry& entry) const;
|
||||
bool operator==(const SocketEntry& entry) const
|
||||
{
|
||||
return _socket == entry._socket;
|
||||
}
|
||||
|
||||
bool operator<(const SocketEntry& entry) const;
|
||||
bool operator<(const SocketEntry& entry) const
|
||||
{
|
||||
return _socket < entry._socket;
|
||||
}
|
||||
|
||||
void addCommandEvent(const CommandEvent& cev);
|
||||
|
||||
|
@ -154,8 +178,11 @@ private:
|
|||
|
||||
struct epoll_event& getEpEvent();
|
||||
|
||||
sock_t getSocket() const;
|
||||
|
||||
sock_t getSocket() const
|
||||
{
|
||||
return _socket;
|
||||
}
|
||||
|
||||
bool eventEmpty() const;
|
||||
|
||||
void processEvents(int events);
|
||||
|
@ -177,7 +204,11 @@ private:
|
|||
AsyncNameResolverEntry(const SharedHandle<AsyncNameResolver>& nameResolver,
|
||||
Command* command);
|
||||
|
||||
bool operator==(const AsyncNameResolverEntry& entry);
|
||||
bool operator==(const AsyncNameResolverEntry& entry)
|
||||
{
|
||||
return _nameResolver == entry._nameResolver &&
|
||||
_command == entry._command;
|
||||
}
|
||||
|
||||
void addSocketEvents(EpollEventPoll* socketPoll);
|
||||
|
||||
|
|
|
@ -446,9 +446,4 @@ void FtpConnection::setBaseWorkingDir(const std::string& baseWorkingDir)
|
|||
_baseWorkingDir = baseWorkingDir;
|
||||
}
|
||||
|
||||
const std::string& FtpConnection::getBaseWorkingDir() const
|
||||
{
|
||||
return _baseWorkingDir;
|
||||
}
|
||||
|
||||
} // namespace aria2
|
||||
|
|
|
@ -114,7 +114,10 @@ public:
|
|||
|
||||
void setBaseWorkingDir(const std::string& baseWorkingDir);
|
||||
|
||||
const std::string& getBaseWorkingDir() const;
|
||||
const std::string& getBaseWorkingDir() const
|
||||
{
|
||||
return _baseWorkingDir;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace aria2
|
||||
|
|
|
@ -63,16 +63,6 @@ HttpRequestEntry::HttpRequestEntry(const HttpRequestHandle& httpRequest):
|
|||
|
||||
HttpRequestEntry::~HttpRequestEntry() {}
|
||||
|
||||
HttpRequestHandle HttpRequestEntry::getHttpRequest() const
|
||||
{
|
||||
return _httpRequest;
|
||||
}
|
||||
|
||||
HttpHeaderProcessorHandle HttpRequestEntry::getHttpHeaderProcessor() const
|
||||
{
|
||||
return _proc;
|
||||
}
|
||||
|
||||
HttpConnection::HttpConnection(int32_t cuid,
|
||||
const SocketHandle& socket,
|
||||
const Option* op):
|
||||
|
|
|
@ -62,9 +62,15 @@ public:
|
|||
|
||||
~HttpRequestEntry();
|
||||
|
||||
SharedHandle<HttpRequest> getHttpRequest() const;
|
||||
const SharedHandle<HttpRequest>& getHttpRequest() const
|
||||
{
|
||||
return _httpRequest;
|
||||
}
|
||||
|
||||
SharedHandle<HttpHeaderProcessor> getHttpHeaderProcessor() const;
|
||||
const SharedHandle<HttpHeaderProcessor>& getHttpHeaderProcessor() const
|
||||
{
|
||||
return _proc;
|
||||
}
|
||||
};
|
||||
|
||||
typedef SharedHandle<HttpRequestEntry> HttpRequestEntryHandle;
|
||||
|
|
|
@ -173,41 +173,21 @@ RangeHandle HttpHeader::getRange() const
|
|||
return SharedHandle<Range>(new Range(startByte, endByte, entityLength));
|
||||
}
|
||||
|
||||
const std::string& HttpHeader::getResponseStatus() const
|
||||
{
|
||||
return _responseStatus;
|
||||
}
|
||||
|
||||
void HttpHeader::setResponseStatus(const std::string& responseStatus)
|
||||
{
|
||||
_responseStatus = responseStatus;
|
||||
}
|
||||
|
||||
const std::string& HttpHeader::getVersion() const
|
||||
{
|
||||
return _version;
|
||||
}
|
||||
|
||||
void HttpHeader::setVersion(const std::string& version)
|
||||
{
|
||||
_version = version;
|
||||
}
|
||||
|
||||
const std::string& HttpHeader::getMethod() const
|
||||
{
|
||||
return _method;
|
||||
}
|
||||
|
||||
void HttpHeader::setMethod(const std::string& method)
|
||||
{
|
||||
_method = method;
|
||||
}
|
||||
|
||||
const std::string& HttpHeader::getRequestPath() const
|
||||
{
|
||||
return _requestPath;
|
||||
}
|
||||
|
||||
void HttpHeader::setRequestPath(const std::string& requestPath)
|
||||
{
|
||||
_requestPath = requestPath;
|
||||
|
|
|
@ -77,19 +77,31 @@ public:
|
|||
|
||||
SharedHandle<Range> getRange() const;
|
||||
|
||||
const std::string& getResponseStatus() const;
|
||||
const std::string& getResponseStatus() const
|
||||
{
|
||||
return _responseStatus;
|
||||
}
|
||||
|
||||
void setResponseStatus(const std::string& responseStatus);
|
||||
|
||||
const std::string& getVersion() const;
|
||||
const std::string& getVersion() const
|
||||
{
|
||||
return _version;
|
||||
}
|
||||
|
||||
void setVersion(const std::string& version);
|
||||
|
||||
const std::string& getMethod() const;
|
||||
const std::string& getMethod() const
|
||||
{
|
||||
return _method;
|
||||
}
|
||||
|
||||
void setMethod(const std::string& method);
|
||||
|
||||
const std::string& getRequestPath() const;
|
||||
const std::string& getRequestPath() const
|
||||
{
|
||||
return _requestPath;
|
||||
}
|
||||
|
||||
void setRequestPath(const std::string& requestPath);
|
||||
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
#include <cassert>
|
||||
#include <numeric>
|
||||
|
||||
#include "Request.h"
|
||||
#include "Segment.h"
|
||||
#include "Range.h"
|
||||
#include "CookieStorage.h"
|
||||
|
@ -59,11 +58,6 @@ HttpRequest::HttpRequest():entityLength(0),
|
|||
userAgent(USER_AGENT)
|
||||
{}
|
||||
|
||||
SharedHandle<Segment> HttpRequest::getSegment() const
|
||||
{
|
||||
return segment;
|
||||
}
|
||||
|
||||
void HttpRequest::setSegment(const SharedHandle<Segment>& segment)
|
||||
{
|
||||
this->segment = segment;
|
||||
|
@ -74,11 +68,6 @@ void HttpRequest::setRequest(const SharedHandle<Request>& request)
|
|||
this->request = request;
|
||||
}
|
||||
|
||||
SharedHandle<Request> HttpRequest::getRequest() const
|
||||
{
|
||||
return request;
|
||||
}
|
||||
|
||||
off_t HttpRequest::getStartByte() const
|
||||
{
|
||||
if(segment.isNull()) {
|
||||
|
@ -287,62 +276,12 @@ void HttpRequest::addAcceptType(const std::string& type)
|
|||
_acceptTypes.push_back(type);
|
||||
}
|
||||
|
||||
const std::string& HttpRequest::getPreviousURI() const
|
||||
{
|
||||
return request->getPreviousUrl();
|
||||
}
|
||||
|
||||
const std::string& HttpRequest::getHost() const
|
||||
{
|
||||
return request->getHost();
|
||||
}
|
||||
|
||||
uint16_t HttpRequest::getPort() const
|
||||
{
|
||||
return request->getPort();
|
||||
}
|
||||
|
||||
const std::string& HttpRequest::getMethod() const
|
||||
{
|
||||
return request->getMethod();
|
||||
}
|
||||
|
||||
const std::string& HttpRequest::getProtocol() const
|
||||
{
|
||||
return request->getProtocol();
|
||||
}
|
||||
|
||||
const std::string& HttpRequest::getCurrentURI() const
|
||||
{
|
||||
return request->getCurrentUrl();
|
||||
}
|
||||
|
||||
const std::string& HttpRequest::getDir() const
|
||||
{
|
||||
return request->getDir();
|
||||
}
|
||||
|
||||
const std::string& HttpRequest::getFile() const
|
||||
{
|
||||
return request->getFile();
|
||||
}
|
||||
|
||||
const std::string& HttpRequest::getQuery() const
|
||||
{
|
||||
return request->getQuery();
|
||||
}
|
||||
|
||||
void HttpRequest::setCookieStorage
|
||||
(const SharedHandle<CookieStorage>& cookieStorage)
|
||||
{
|
||||
_cookieStorage = cookieStorage;
|
||||
}
|
||||
|
||||
SharedHandle<CookieStorage> HttpRequest::getCookieStorage() const
|
||||
{
|
||||
return _cookieStorage;
|
||||
}
|
||||
|
||||
void HttpRequest::setAuthConfigFactory
|
||||
(const SharedHandle<AuthConfigFactory>& factory)
|
||||
{
|
||||
|
|
|
@ -41,10 +41,10 @@
|
|||
#include <deque>
|
||||
|
||||
#include "SharedHandle.h"
|
||||
#include "Request.h"
|
||||
|
||||
namespace aria2 {
|
||||
|
||||
class Request;
|
||||
class Segment;
|
||||
class Range;
|
||||
class Option;
|
||||
|
@ -85,7 +85,10 @@ private:
|
|||
public:
|
||||
HttpRequest();
|
||||
|
||||
SharedHandle<Segment> getSegment() const;
|
||||
const SharedHandle<Segment>& getSegment() const
|
||||
{
|
||||
return segment;
|
||||
}
|
||||
|
||||
void setSegment(const SharedHandle<Segment>& segment);
|
||||
|
||||
|
@ -104,23 +107,50 @@ public:
|
|||
return entityLength;
|
||||
}
|
||||
|
||||
const std::string& getHost() const;
|
||||
const std::string& getHost() const
|
||||
{
|
||||
return request->getHost();
|
||||
}
|
||||
|
||||
uint16_t getPort() const;
|
||||
uint16_t getPort() const
|
||||
{
|
||||
return request->getPort();
|
||||
}
|
||||
|
||||
const std::string& getMethod() const;
|
||||
const std::string& getMethod() const
|
||||
{
|
||||
return request->getMethod();
|
||||
}
|
||||
|
||||
const std::string& getProtocol() const;
|
||||
const std::string& getProtocol() const
|
||||
{
|
||||
return request->getProtocol();
|
||||
}
|
||||
|
||||
const std::string& getCurrentURI() const;
|
||||
const std::string& getCurrentURI() const
|
||||
{
|
||||
return request->getCurrentUrl();
|
||||
}
|
||||
|
||||
const std::string& getDir() const;
|
||||
const std::string& getDir() const
|
||||
{
|
||||
return request->getDir();
|
||||
}
|
||||
|
||||
const std::string& getFile() const;
|
||||
const std::string& getFile() const
|
||||
{
|
||||
return request->getFile();
|
||||
}
|
||||
|
||||
const std::string& getQuery() const;
|
||||
const std::string& getQuery() const
|
||||
{
|
||||
return request->getQuery();
|
||||
}
|
||||
|
||||
const std::string& getPreviousURI() const;
|
||||
const std::string& getPreviousURI() const
|
||||
{
|
||||
return request->getPreviousUrl();
|
||||
}
|
||||
|
||||
SharedHandle<Range> getRange() const;
|
||||
|
||||
|
@ -130,7 +160,10 @@ public:
|
|||
*/
|
||||
bool isRangeSatisfied(const SharedHandle<Range>& range) const;
|
||||
|
||||
SharedHandle<Request> getRequest() const;
|
||||
const SharedHandle<Request>& getRequest() const
|
||||
{
|
||||
return request;
|
||||
}
|
||||
|
||||
off_t getStartByte() const;
|
||||
|
||||
|
@ -173,7 +206,10 @@ public:
|
|||
|
||||
void setCookieStorage(const SharedHandle<CookieStorage>& cookieStorage);
|
||||
|
||||
SharedHandle<CookieStorage> getCookieStorage() const;
|
||||
const SharedHandle<CookieStorage>& getCookieStorage() const
|
||||
{
|
||||
return _cookieStorage;
|
||||
}
|
||||
|
||||
void setAuthConfigFactory(const SharedHandle<AuthConfigFactory>& factory);
|
||||
|
||||
|
|
|
@ -228,21 +228,11 @@ void HttpResponse::setHttpHeader(const SharedHandle<HttpHeader>& httpHeader)
|
|||
this->httpHeader = httpHeader;
|
||||
}
|
||||
|
||||
SharedHandle<HttpHeader> HttpResponse::getHttpHeader() const
|
||||
{
|
||||
return httpHeader;
|
||||
}
|
||||
|
||||
void HttpResponse::setHttpRequest(const SharedHandle<HttpRequest>& httpRequest)
|
||||
{
|
||||
this->httpRequest = httpRequest;
|
||||
}
|
||||
|
||||
SharedHandle<HttpRequest> HttpResponse::getHttpRequest() const
|
||||
{
|
||||
return httpRequest;
|
||||
}
|
||||
|
||||
// TODO return std::string
|
||||
const std::string& HttpResponse::getResponseStatus() const
|
||||
{
|
||||
|
|
|
@ -102,13 +102,19 @@ public:
|
|||
|
||||
void setHttpHeader(const SharedHandle<HttpHeader>& httpHeader);
|
||||
|
||||
SharedHandle<HttpHeader> getHttpHeader() const;
|
||||
const SharedHandle<HttpHeader>& getHttpHeader() const
|
||||
{
|
||||
return httpHeader;
|
||||
}
|
||||
|
||||
const std::string& getResponseStatus() const;
|
||||
|
||||
void setHttpRequest(const SharedHandle<HttpRequest>& httpRequest);
|
||||
|
||||
SharedHandle<HttpRequest> getHttpRequest() const;
|
||||
const SharedHandle<HttpRequest>& getHttpRequest() const
|
||||
{
|
||||
return httpRequest;
|
||||
}
|
||||
|
||||
void setCuid(int32_t cuid)
|
||||
{
|
||||
|
|
|
@ -103,11 +103,6 @@ void TLSContext::addTrustedCACertFile(const std::string& certfile)
|
|||
}
|
||||
}
|
||||
|
||||
SSL_CTX* TLSContext::getSSLCtx() const
|
||||
{
|
||||
return _sslCtx;
|
||||
}
|
||||
|
||||
void TLSContext::enablePeerVerification()
|
||||
{
|
||||
_peerVerificationEnabled = true;
|
||||
|
@ -118,9 +113,4 @@ void TLSContext::disablePeerVerification()
|
|||
_peerVerificationEnabled = false;
|
||||
}
|
||||
|
||||
bool TLSContext::peerVerificationEnabled() const
|
||||
{
|
||||
return _peerVerificationEnabled;
|
||||
}
|
||||
|
||||
} // namespace aria2
|
||||
|
|
|
@ -72,13 +72,20 @@ public:
|
|||
|
||||
bool bad() const;
|
||||
|
||||
SSL_CTX* getSSLCtx() const;
|
||||
SSL_CTX* getSSLCtx() const
|
||||
{
|
||||
return _sslCtx;
|
||||
}
|
||||
|
||||
void enablePeerVerification();
|
||||
|
||||
void disablePeerVerification();
|
||||
|
||||
bool peerVerificationEnabled() const;
|
||||
bool peerVerificationEnabled() const
|
||||
{
|
||||
return _peerVerificationEnabled;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
} // namespace aria2
|
||||
|
|
|
@ -590,44 +590,4 @@ size_t MSEHandshake::receiveNBytes(size_t bytes)
|
|||
return r;
|
||||
}
|
||||
|
||||
const unsigned char* MSEHandshake::getIA() const
|
||||
{
|
||||
return _ia;
|
||||
}
|
||||
|
||||
size_t MSEHandshake::getIALength() const
|
||||
{
|
||||
return _iaLength;
|
||||
}
|
||||
|
||||
const unsigned char* MSEHandshake::getInfoHash() const
|
||||
{
|
||||
return _infoHash;
|
||||
}
|
||||
|
||||
MSEHandshake::CRYPTO_TYPE MSEHandshake::getNegotiatedCryptoType() const
|
||||
{
|
||||
return _negotiatedCryptoType;
|
||||
}
|
||||
|
||||
SharedHandle<ARC4Encryptor> MSEHandshake::getEncryptor() const
|
||||
{
|
||||
return _encryptor;
|
||||
}
|
||||
|
||||
SharedHandle<ARC4Decryptor> MSEHandshake::getDecryptor() const
|
||||
{
|
||||
return _decryptor;
|
||||
}
|
||||
|
||||
const unsigned char* MSEHandshake::getBuffer() const
|
||||
{
|
||||
return _rbuf;
|
||||
}
|
||||
|
||||
size_t MSEHandshake::getBufferLength() const
|
||||
{
|
||||
return _rbufLength;
|
||||
}
|
||||
|
||||
} // namespace aria2
|
||||
|
|
|
@ -167,21 +167,46 @@ public:
|
|||
bool sendReceiverStep2();
|
||||
|
||||
// returns plain text IA
|
||||
const unsigned char* getIA() const;
|
||||
const unsigned char* getIA() const
|
||||
{
|
||||
return _ia;
|
||||
}
|
||||
|
||||
size_t getIALength() const;
|
||||
size_t getIALength() const
|
||||
{
|
||||
return _iaLength;
|
||||
}
|
||||
|
||||
const unsigned char* getInfoHash() const;
|
||||
const unsigned char* getInfoHash() const
|
||||
{
|
||||
return _infoHash;
|
||||
}
|
||||
|
||||
CRYPTO_TYPE getNegotiatedCryptoType() const;
|
||||
CRYPTO_TYPE getNegotiatedCryptoType() const
|
||||
{
|
||||
return _negotiatedCryptoType;
|
||||
}
|
||||
|
||||
SharedHandle<ARC4Encryptor> getEncryptor() const;
|
||||
const SharedHandle<ARC4Encryptor>& getEncryptor() const
|
||||
{
|
||||
return _encryptor;
|
||||
}
|
||||
|
||||
SharedHandle<ARC4Decryptor> getDecryptor() const;
|
||||
const SharedHandle<ARC4Decryptor>& getDecryptor() const
|
||||
{
|
||||
return _decryptor;
|
||||
}
|
||||
|
||||
const unsigned char* getBuffer() const;
|
||||
const unsigned char* getBuffer() const
|
||||
{
|
||||
return _rbuf;
|
||||
}
|
||||
|
||||
size_t getBufferLength() const
|
||||
{
|
||||
return _rbufLength;
|
||||
}
|
||||
|
||||
size_t getBufferLength() const;
|
||||
};
|
||||
|
||||
} // namespace aria2
|
||||
|
|
|
@ -181,19 +181,9 @@ void MetalinkEntry::toFileEntry
|
|||
mem_fun_sh(&MetalinkEntry::getFile));
|
||||
}
|
||||
|
||||
SharedHandle<FileEntry> MetalinkEntry::getFile() const
|
||||
{
|
||||
return file;
|
||||
}
|
||||
|
||||
void MetalinkEntry::setSignature(const SharedHandle<Signature>& signature)
|
||||
{
|
||||
_signature = signature;
|
||||
}
|
||||
|
||||
SharedHandle<Signature> MetalinkEntry::getSignature() const
|
||||
{
|
||||
return _signature;
|
||||
}
|
||||
|
||||
} // namespace aria2
|
||||
|
|
|
@ -36,10 +36,12 @@
|
|||
#define _D_METALINK_ENTRY_H_
|
||||
|
||||
#include "common.h"
|
||||
#include "SharedHandle.h"
|
||||
|
||||
#include <string>
|
||||
#include <deque>
|
||||
|
||||
#include "SharedHandle.h"
|
||||
|
||||
namespace aria2 {
|
||||
|
||||
class MetalinkResource;
|
||||
|
@ -75,7 +77,10 @@ public:
|
|||
|
||||
uint64_t getLength() const;
|
||||
|
||||
SharedHandle<FileEntry> getFile() const;
|
||||
const SharedHandle<FileEntry>& getFile() const
|
||||
{
|
||||
return file;
|
||||
}
|
||||
|
||||
void dropUnsupportedResource();
|
||||
|
||||
|
@ -90,7 +95,11 @@ public:
|
|||
|
||||
void setSignature(const SharedHandle<Signature>& signature);
|
||||
|
||||
SharedHandle<Signature> getSignature() const;
|
||||
const SharedHandle<Signature>& getSignature() const
|
||||
{
|
||||
return _signature;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
} // namespace aria2
|
||||
|
|
|
@ -60,11 +60,6 @@ MetalinkParserController::MetalinkParserController():
|
|||
|
||||
MetalinkParserController::~MetalinkParserController() {}
|
||||
|
||||
SharedHandle<Metalinker> MetalinkParserController::getResult() const
|
||||
{
|
||||
return _metalinker;
|
||||
}
|
||||
|
||||
void MetalinkParserController::newEntryTransaction()
|
||||
{
|
||||
_tEntry.reset(new MetalinkEntry());
|
||||
|
|
|
@ -79,7 +79,10 @@ public:
|
|||
|
||||
~MetalinkParserController();
|
||||
|
||||
SharedHandle<Metalinker> getResult() const;
|
||||
const SharedHandle<Metalinker>& getResult() const
|
||||
{
|
||||
return _metalinker;
|
||||
}
|
||||
|
||||
void newEntryTransaction();
|
||||
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
*/
|
||||
/* copyright --> */
|
||||
#include "MetalinkParserStateMachine.h"
|
||||
#include "MetalinkParserController.h"
|
||||
#include "InitialMetalinkParserState.h"
|
||||
#include "MetalinkMetalinkParserState.h"
|
||||
#include "FilesMetalinkParserState.h"
|
||||
|
@ -368,9 +367,4 @@ bool MetalinkParserStateMachine::needsCharactersBuffering() const
|
|||
return _state->needsCharactersBuffering();
|
||||
}
|
||||
|
||||
SharedHandle<Metalinker> MetalinkParserStateMachine::getResult() const
|
||||
{
|
||||
return _ctrl->getResult();
|
||||
}
|
||||
|
||||
} // namespace aria2
|
||||
|
|
|
@ -36,13 +36,14 @@
|
|||
#define _D_METALINK_PARSER_STATE_MACHINE_H_
|
||||
|
||||
#include "common.h"
|
||||
#include "SharedHandle.h"
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
#include "SharedHandle.h"
|
||||
#include "MetalinkParserController.h"
|
||||
|
||||
namespace aria2 {
|
||||
|
||||
class MetalinkParserController;
|
||||
class MetalinkParserState;
|
||||
class SkipTagMetalinkParserState;
|
||||
class Metalinker;
|
||||
|
@ -191,7 +192,10 @@ public:
|
|||
|
||||
bool needsCharactersBuffering() const;
|
||||
|
||||
SharedHandle<Metalinker> getResult() const;
|
||||
const SharedHandle<Metalinker>& getResult() const
|
||||
{
|
||||
return _ctrl->getResult();
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace aria2
|
||||
|
|
|
@ -96,11 +96,6 @@ void DiskWriterEntry::openExistingFile()
|
|||
}
|
||||
}
|
||||
|
||||
bool DiskWriterEntry::isOpen() const
|
||||
{
|
||||
return _open;
|
||||
}
|
||||
|
||||
void DiskWriterEntry::closeFile()
|
||||
{
|
||||
if(_open) {
|
||||
|
@ -119,21 +114,11 @@ uint64_t DiskWriterEntry::size() const
|
|||
return File(getFilePath()).size();
|
||||
}
|
||||
|
||||
SharedHandle<FileEntry> DiskWriterEntry::getFileEntry() const
|
||||
{
|
||||
return fileEntry;
|
||||
}
|
||||
|
||||
void DiskWriterEntry::setDiskWriter(const SharedHandle<DiskWriter>& diskWriter)
|
||||
{
|
||||
this->diskWriter = diskWriter;
|
||||
}
|
||||
|
||||
SharedHandle<DiskWriter> DiskWriterEntry::getDiskWriter() const
|
||||
{
|
||||
return diskWriter;
|
||||
}
|
||||
|
||||
bool DiskWriterEntry::operator<(const DiskWriterEntry& entry) const
|
||||
{
|
||||
return fileEntry < entry.fileEntry;
|
||||
|
@ -155,16 +140,6 @@ void DiskWriterEntry::disableDirectIO()
|
|||
_directIO = false;
|
||||
}
|
||||
|
||||
bool DiskWriterEntry::needsFileAllocation() const
|
||||
{
|
||||
return _needsFileAllocation;
|
||||
}
|
||||
|
||||
void DiskWriterEntry::needsFileAllocation(bool f)
|
||||
{
|
||||
_needsFileAllocation = f;
|
||||
}
|
||||
|
||||
MultiDiskAdaptor::MultiDiskAdaptor():
|
||||
pieceLength(0),
|
||||
_maxOpenFiles(DEFAULT_MAX_OPEN_FILES),
|
||||
|
@ -552,10 +527,4 @@ size_t MultiDiskAdaptor::utime(const Time& actime, const Time& modtime)
|
|||
return numOK;
|
||||
}
|
||||
|
||||
const std::deque<SharedHandle<DiskWriterEntry> >&
|
||||
MultiDiskAdaptor::getDiskWriterEntries() const
|
||||
{
|
||||
return diskWriterEntries;
|
||||
}
|
||||
|
||||
} // namespace aria2
|
||||
|
|
|
@ -65,17 +65,26 @@ public:
|
|||
|
||||
void closeFile();
|
||||
|
||||
bool isOpen() const;
|
||||
bool isOpen() const
|
||||
{
|
||||
return _open;
|
||||
}
|
||||
|
||||
bool fileExists();
|
||||
|
||||
uint64_t size() const;
|
||||
|
||||
SharedHandle<FileEntry> getFileEntry() const;
|
||||
const SharedHandle<FileEntry>& getFileEntry() const
|
||||
{
|
||||
return fileEntry;
|
||||
}
|
||||
|
||||
void setDiskWriter(const SharedHandle<DiskWriter>& diskWriter);
|
||||
|
||||
SharedHandle<DiskWriter> getDiskWriter() const;
|
||||
const SharedHandle<DiskWriter>& getDiskWriter() const
|
||||
{
|
||||
return diskWriter;
|
||||
}
|
||||
|
||||
bool operator<(const DiskWriterEntry& entry) const;
|
||||
|
||||
|
@ -89,9 +98,16 @@ public:
|
|||
// called.
|
||||
void disableDirectIO();
|
||||
|
||||
bool needsFileAllocation() const;
|
||||
bool needsFileAllocation() const
|
||||
{
|
||||
return _needsFileAllocation;
|
||||
}
|
||||
|
||||
void needsFileAllocation(bool f)
|
||||
{
|
||||
_needsFileAllocation = f;
|
||||
}
|
||||
|
||||
void needsFileAllocation(bool f);
|
||||
};
|
||||
|
||||
typedef SharedHandle<DiskWriterEntry> DiskWriterEntryHandle;
|
||||
|
@ -177,7 +193,11 @@ public:
|
|||
virtual size_t utime(const Time& actime, const Time& modtime);
|
||||
|
||||
const std::deque<SharedHandle<DiskWriterEntry> >&
|
||||
getDiskWriterEntries() const;
|
||||
getDiskWriterEntries() const
|
||||
{
|
||||
return diskWriterEntries;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
typedef SharedHandle<MultiDiskAdaptor> MultiDiskAdaptorHandle;
|
||||
|
|
|
@ -73,11 +73,6 @@ void NetrcAuthResolver::setNetrc(const NetrcHandle& netrc)
|
|||
_netrc = netrc;
|
||||
}
|
||||
|
||||
NetrcHandle NetrcAuthResolver::getNetrc() const
|
||||
{
|
||||
return _netrc;
|
||||
}
|
||||
|
||||
void NetrcAuthResolver::ignoreDefault()
|
||||
{
|
||||
_ignoreDefault = true;
|
||||
|
|
|
@ -57,7 +57,10 @@ public:
|
|||
|
||||
void setNetrc(const SharedHandle<Netrc>& netrc);
|
||||
|
||||
SharedHandle<Netrc> getNetrc() const;
|
||||
const SharedHandle<Netrc>& getNetrc() const
|
||||
{
|
||||
return _netrc;
|
||||
}
|
||||
|
||||
// Ignores default token of netrc
|
||||
void ignoreDefault();
|
||||
|
|
55
src/Peer.cc
55
src/Peer.cc
|
@ -71,36 +71,11 @@ Peer::~Peer()
|
|||
releaseSessionResource();
|
||||
}
|
||||
|
||||
bool Peer::operator==(const Peer& p)
|
||||
{
|
||||
return id == p.id;
|
||||
}
|
||||
|
||||
bool Peer::operator!=(const Peer& p)
|
||||
{
|
||||
return !(*this == p);
|
||||
}
|
||||
|
||||
const std::string& Peer::getID() const
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
void Peer::usedBy(int32_t cuid)
|
||||
{
|
||||
_cuid = cuid;
|
||||
}
|
||||
|
||||
int32_t Peer::usedBy() const
|
||||
{
|
||||
return _cuid;
|
||||
}
|
||||
|
||||
bool Peer::unused() const
|
||||
{
|
||||
return _cuid == 0;
|
||||
}
|
||||
|
||||
void Peer::allocateSessionResource(size_t pieceLength, uint64_t totalLength)
|
||||
{
|
||||
delete _res;
|
||||
|
@ -114,21 +89,11 @@ void Peer::releaseSessionResource()
|
|||
_res = 0;
|
||||
}
|
||||
|
||||
bool Peer::isActive() const
|
||||
{
|
||||
return _res != 0;
|
||||
}
|
||||
|
||||
void Peer::setPeerId(const unsigned char* peerId)
|
||||
{
|
||||
memcpy(_peerId, peerId, PEER_ID_LENGTH);
|
||||
}
|
||||
|
||||
const unsigned char* Peer::getPeerId() const
|
||||
{
|
||||
return _peerId;
|
||||
}
|
||||
|
||||
void Peer::resetStatus() {
|
||||
_cuid = 0;
|
||||
}
|
||||
|
@ -432,21 +397,6 @@ bool Peer::isDHTEnabled() const
|
|||
return _res->dhtEnabled();
|
||||
}
|
||||
|
||||
bool Peer::isSeeder() const
|
||||
{
|
||||
return _seeder;
|
||||
}
|
||||
|
||||
const Time& Peer::getFirstContactTime() const
|
||||
{
|
||||
return _firstContactTime;
|
||||
}
|
||||
|
||||
const Time& Peer::getBadConditionStartTime() const
|
||||
{
|
||||
return _badConditionStartTime;
|
||||
}
|
||||
|
||||
const Time& Peer::getLastDownloadUpdate() const
|
||||
{
|
||||
assert(_res);
|
||||
|
@ -465,11 +415,6 @@ uint64_t Peer::getCompletedLength() const
|
|||
return _res->getCompletedLength();
|
||||
}
|
||||
|
||||
bool Peer::isIncomingPeer() const
|
||||
{
|
||||
return _incoming;
|
||||
}
|
||||
|
||||
void Peer::setIncomingPeer(bool incoming)
|
||||
{
|
||||
_incoming = incoming;
|
||||
|
|
62
src/Peer.h
62
src/Peer.h
|
@ -36,12 +36,15 @@
|
|||
#define _D_PEER_H_
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <string>
|
||||
#include <deque>
|
||||
|
||||
#include "SharedHandle.h"
|
||||
#include "TimeA2.h"
|
||||
#include "BtConstants.h"
|
||||
#include "PeerStat.h"
|
||||
#include <string>
|
||||
#include <deque>
|
||||
|
||||
namespace aria2 {
|
||||
|
||||
|
@ -82,28 +85,52 @@ public:
|
|||
|
||||
~Peer();
|
||||
|
||||
bool operator==(const Peer& p);
|
||||
bool operator==(const Peer& p)
|
||||
{
|
||||
return id == p.id;
|
||||
}
|
||||
|
||||
bool operator!=(const Peer& p);
|
||||
bool operator!=(const Peer& p)
|
||||
{
|
||||
return !(*this == p);
|
||||
}
|
||||
|
||||
void resetStatus();
|
||||
|
||||
void usedBy(int32_t cuid);
|
||||
|
||||
int32_t usedBy() const;
|
||||
int32_t usedBy() const
|
||||
{
|
||||
return _cuid;
|
||||
}
|
||||
|
||||
bool unused() const;
|
||||
bool unused() const
|
||||
{
|
||||
return _cuid == 0;
|
||||
}
|
||||
|
||||
// Returns true iff _res != 0.
|
||||
bool isActive() const;
|
||||
bool isActive() const
|
||||
{
|
||||
return _res != 0;
|
||||
}
|
||||
|
||||
void setPeerId(const unsigned char* peerId);
|
||||
|
||||
const unsigned char* getPeerId() const;
|
||||
const unsigned char* getPeerId() const
|
||||
{
|
||||
return _peerId;
|
||||
}
|
||||
|
||||
bool isSeeder() const;
|
||||
bool isSeeder() const
|
||||
{
|
||||
return _seeder;
|
||||
}
|
||||
|
||||
const std::string& getID() const;
|
||||
const std::string& getID() const
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
void startBadCondition();
|
||||
|
||||
|
@ -113,11 +140,17 @@ public:
|
|||
|
||||
void releaseSessionResource();
|
||||
|
||||
const Time& getFirstContactTime() const;
|
||||
const Time& getFirstContactTime() const
|
||||
{
|
||||
return _firstContactTime;
|
||||
}
|
||||
|
||||
void setFirstContactTime(const Time& time);
|
||||
|
||||
const Time& getBadConditionStartTime() const;
|
||||
const Time& getBadConditionStartTime() const
|
||||
{
|
||||
return _badConditionStartTime;
|
||||
}
|
||||
|
||||
// Before calling following member functions, make sure that
|
||||
// allocateSessionResource() is called and _res is created.
|
||||
|
@ -244,7 +277,10 @@ public:
|
|||
|
||||
uint64_t getCompletedLength() const;
|
||||
|
||||
bool isIncomingPeer() const;
|
||||
bool isIncomingPeer() const
|
||||
{
|
||||
return _incoming;
|
||||
}
|
||||
|
||||
void setIncomingPeer(bool incoming);
|
||||
|
||||
|
|
|
@ -66,11 +66,6 @@ PeerSessionResource::~PeerSessionResource()
|
|||
delete _bitfieldMan;
|
||||
}
|
||||
|
||||
bool PeerSessionResource::amChoking() const
|
||||
{
|
||||
return _amChoking;
|
||||
}
|
||||
|
||||
void PeerSessionResource::amChoking(bool b)
|
||||
{
|
||||
_amChoking = b;
|
||||
|
@ -79,51 +74,26 @@ void PeerSessionResource::amChoking(bool b)
|
|||
}
|
||||
}
|
||||
|
||||
bool PeerSessionResource::amInterested() const
|
||||
{
|
||||
return _amInterested;
|
||||
}
|
||||
|
||||
void PeerSessionResource::amInterested(bool b)
|
||||
{
|
||||
_amInterested = b;
|
||||
}
|
||||
|
||||
bool PeerSessionResource::peerChoking() const
|
||||
{
|
||||
return _peerChoking;
|
||||
}
|
||||
|
||||
void PeerSessionResource::peerChoking(bool b)
|
||||
{
|
||||
_peerChoking = b;
|
||||
}
|
||||
|
||||
bool PeerSessionResource::peerInterested() const
|
||||
{
|
||||
return _peerInterested;
|
||||
}
|
||||
|
||||
void PeerSessionResource::peerInterested(bool b)
|
||||
{
|
||||
_peerInterested = b;
|
||||
}
|
||||
|
||||
bool PeerSessionResource::chokingRequired() const
|
||||
{
|
||||
return _chokingRequired;
|
||||
}
|
||||
|
||||
void PeerSessionResource::chokingRequired(bool b)
|
||||
{
|
||||
_chokingRequired = b;
|
||||
}
|
||||
|
||||
bool PeerSessionResource::optUnchoking() const
|
||||
{
|
||||
return _optUnchoking;
|
||||
}
|
||||
|
||||
void PeerSessionResource::optUnchoking(bool b)
|
||||
{
|
||||
_optUnchoking = b;
|
||||
|
@ -137,11 +107,6 @@ bool PeerSessionResource::shouldBeChoking() const
|
|||
return _chokingRequired;
|
||||
}
|
||||
|
||||
bool PeerSessionResource::snubbing() const
|
||||
{
|
||||
return _snubbing;
|
||||
}
|
||||
|
||||
void PeerSessionResource::snubbing(bool b)
|
||||
{
|
||||
_snubbing = b;
|
||||
|
@ -190,11 +155,6 @@ void PeerSessionResource::markSeeder()
|
|||
_bitfieldMan->setAllBit();
|
||||
}
|
||||
|
||||
bool PeerSessionResource::fastExtensionEnabled() const
|
||||
{
|
||||
return _fastExtensionEnabled;
|
||||
}
|
||||
|
||||
void PeerSessionResource::fastExtensionEnabled(bool b)
|
||||
{
|
||||
_fastExtensionEnabled = b;
|
||||
|
@ -225,11 +185,6 @@ bool PeerSessionResource::peerAllowedIndexSetContains(size_t index) const
|
|||
index);
|
||||
}
|
||||
|
||||
const std::deque<size_t>& PeerSessionResource::amAllowedIndexSet() const
|
||||
{
|
||||
return _amAllowedIndexSet;
|
||||
}
|
||||
|
||||
void PeerSessionResource::addAmAllowedIndex(size_t index)
|
||||
{
|
||||
updateIndexSet(_amAllowedIndexSet, index);
|
||||
|
@ -242,11 +197,6 @@ bool PeerSessionResource::amAllowedIndexSetContains(size_t index) const
|
|||
index);
|
||||
}
|
||||
|
||||
bool PeerSessionResource::extendedMessagingEnabled() const
|
||||
{
|
||||
return _extendedMessagingEnabled;
|
||||
}
|
||||
|
||||
void PeerSessionResource::extendedMessagingEnabled(bool b)
|
||||
{
|
||||
_extendedMessagingEnabled = b;
|
||||
|
@ -280,26 +230,11 @@ void PeerSessionResource::addExtension(const std::string& name, uint8_t id)
|
|||
_extensions[name] = id;
|
||||
}
|
||||
|
||||
bool PeerSessionResource::dhtEnabled() const
|
||||
{
|
||||
return _dhtEnabled;
|
||||
}
|
||||
|
||||
void PeerSessionResource::dhtEnabled(bool b)
|
||||
{
|
||||
_dhtEnabled = b;
|
||||
}
|
||||
|
||||
PeerStat& PeerSessionResource::getPeerStat()
|
||||
{
|
||||
return _peerStat;
|
||||
}
|
||||
|
||||
unsigned int PeerSessionResource::latency() const
|
||||
{
|
||||
return _latency;
|
||||
}
|
||||
|
||||
void PeerSessionResource::updateLatency(unsigned int latency)
|
||||
{
|
||||
_latency = _latency*0.2+latency*0.8;
|
||||
|
@ -327,16 +262,6 @@ void PeerSessionResource::updateDownloadLength(size_t bytes)
|
|||
_lastDownloadUpdate.reset();
|
||||
}
|
||||
|
||||
const Time& PeerSessionResource::getLastDownloadUpdate() const
|
||||
{
|
||||
return _lastDownloadUpdate;
|
||||
}
|
||||
|
||||
const Time& PeerSessionResource::getLastAmUnchoking() const
|
||||
{
|
||||
return _lastAmUnchoking;
|
||||
}
|
||||
|
||||
uint64_t PeerSessionResource::getCompletedLength() const
|
||||
{
|
||||
return _bitfieldMan->getCompletedLength();
|
||||
|
|
|
@ -87,39 +87,60 @@ public:
|
|||
~PeerSessionResource();
|
||||
|
||||
// localhost is choking this peer
|
||||
bool amChoking() const;
|
||||
bool amChoking() const
|
||||
{
|
||||
return _amChoking;
|
||||
}
|
||||
|
||||
void amChoking(bool b);
|
||||
|
||||
// localhost is interested in this peer
|
||||
bool amInterested() const;
|
||||
bool amInterested() const
|
||||
{
|
||||
return _amInterested;
|
||||
}
|
||||
|
||||
void amInterested(bool b);
|
||||
|
||||
// this peer is choking localhost
|
||||
bool peerChoking() const;
|
||||
bool peerChoking() const
|
||||
{
|
||||
return _peerChoking;
|
||||
}
|
||||
|
||||
void peerChoking(bool b);
|
||||
|
||||
// this peer is interested in localhost
|
||||
bool peerInterested() const;
|
||||
bool peerInterested() const
|
||||
{
|
||||
return _peerInterested;
|
||||
}
|
||||
|
||||
void peerInterested(bool b);
|
||||
|
||||
// this peer should be choked
|
||||
bool chokingRequired() const;
|
||||
bool chokingRequired() const
|
||||
{
|
||||
return _chokingRequired;
|
||||
}
|
||||
|
||||
void chokingRequired(bool b);
|
||||
|
||||
// this peer is eligible for unchoking optionally.
|
||||
bool optUnchoking() const;
|
||||
bool optUnchoking() const
|
||||
{
|
||||
return _optUnchoking;
|
||||
}
|
||||
|
||||
void optUnchoking(bool b);
|
||||
|
||||
bool shouldBeChoking() const;
|
||||
|
||||
// this peer is snubbing.
|
||||
bool snubbing() const;
|
||||
bool snubbing() const
|
||||
{
|
||||
return _snubbing;
|
||||
}
|
||||
|
||||
void snubbing(bool b);
|
||||
|
||||
|
@ -137,7 +158,10 @@ public:
|
|||
|
||||
void markSeeder();
|
||||
|
||||
bool fastExtensionEnabled() const;
|
||||
bool fastExtensionEnabled() const
|
||||
{
|
||||
return _fastExtensionEnabled;
|
||||
}
|
||||
|
||||
void fastExtensionEnabled(bool b);
|
||||
|
||||
|
@ -149,13 +173,19 @@ public:
|
|||
bool peerAllowedIndexSetContains(size_t index) const;
|
||||
|
||||
// fast index set which localhost has sent to a peer.
|
||||
const std::deque<size_t>& amAllowedIndexSet() const;
|
||||
const std::deque<size_t>& amAllowedIndexSet() const
|
||||
{
|
||||
return _amAllowedIndexSet;
|
||||
}
|
||||
|
||||
void addAmAllowedIndex(size_t index);
|
||||
|
||||
bool amAllowedIndexSetContains(size_t index) const;
|
||||
|
||||
bool extendedMessagingEnabled() const;
|
||||
bool extendedMessagingEnabled() const
|
||||
{
|
||||
return _extendedMessagingEnabled;
|
||||
}
|
||||
|
||||
void extendedMessagingEnabled(bool b);
|
||||
|
||||
|
@ -165,13 +195,22 @@ public:
|
|||
|
||||
void addExtension(const std::string& name, uint8_t id);
|
||||
|
||||
bool dhtEnabled() const;
|
||||
bool dhtEnabled() const
|
||||
{
|
||||
return _dhtEnabled;
|
||||
}
|
||||
|
||||
void dhtEnabled(bool b);
|
||||
|
||||
PeerStat& getPeerStat();
|
||||
PeerStat& getPeerStat()
|
||||
{
|
||||
return _peerStat;
|
||||
}
|
||||
|
||||
unsigned int latency() const;
|
||||
unsigned int latency() const
|
||||
{
|
||||
return _latency;
|
||||
}
|
||||
|
||||
void updateLatency(unsigned int latency);
|
||||
|
||||
|
@ -183,9 +222,15 @@ public:
|
|||
|
||||
void updateDownloadLength(size_t bytes);
|
||||
|
||||
const Time& getLastDownloadUpdate() const;
|
||||
const Time& getLastDownloadUpdate() const
|
||||
{
|
||||
return _lastDownloadUpdate;
|
||||
}
|
||||
|
||||
const Time& getLastAmUnchoking() const;
|
||||
const Time& getLastAmUnchoking() const
|
||||
{
|
||||
return _lastAmUnchoking;
|
||||
}
|
||||
|
||||
uint64_t getCompletedLength() const;
|
||||
|
||||
|
|
10
src/Piece.cc
10
src/Piece.cc
|
@ -95,16 +95,6 @@ Piece& Piece::operator=(const Piece& piece)
|
|||
return *this;
|
||||
}
|
||||
|
||||
bool Piece::operator==(const Piece& piece) const
|
||||
{
|
||||
return index == piece.index;
|
||||
}
|
||||
|
||||
bool Piece::operator<(const Piece& piece) const
|
||||
{
|
||||
return index < piece.index;
|
||||
}
|
||||
|
||||
void Piece::completeBlock(size_t blockIndex) {
|
||||
bitfield->setBit(blockIndex);
|
||||
bitfield->unsetUseBit(blockIndex);
|
||||
|
|
10
src/Piece.h
10
src/Piece.h
|
@ -82,9 +82,15 @@ public:
|
|||
|
||||
Piece& operator=(const Piece& piece);
|
||||
|
||||
bool operator==(const Piece& piece) const;
|
||||
bool operator==(const Piece& piece) const
|
||||
{
|
||||
return index == piece.index;
|
||||
}
|
||||
|
||||
bool operator<(const Piece& piece) const;
|
||||
bool operator<(const Piece& piece) const
|
||||
{
|
||||
return index < piece.index;
|
||||
}
|
||||
|
||||
bool getMissingUnusedBlockIndex(size_t& index) const;
|
||||
bool getMissingBlockIndex(size_t& index) const;
|
||||
|
|
|
@ -42,15 +42,6 @@ namespace aria2 {
|
|||
|
||||
PieceStat::PieceStat(size_t index):_order(0), _index(index), _count(0) {}
|
||||
|
||||
bool PieceStat::operator<(const PieceStat& pieceStat) const
|
||||
{
|
||||
if(_count == pieceStat._count) {
|
||||
return _order < pieceStat._order;
|
||||
} else {
|
||||
return _count < pieceStat._count;
|
||||
}
|
||||
}
|
||||
|
||||
void PieceStat::addCount()
|
||||
{
|
||||
if(_count < SIZE_MAX) {
|
||||
|
@ -65,26 +56,6 @@ void PieceStat::subCount()
|
|||
}
|
||||
}
|
||||
|
||||
size_t PieceStat::getIndex() const
|
||||
{
|
||||
return _index;
|
||||
}
|
||||
|
||||
size_t PieceStat::getCount() const
|
||||
{
|
||||
return _count;
|
||||
}
|
||||
|
||||
void PieceStat::setOrder(size_t order)
|
||||
{
|
||||
_order = order;
|
||||
}
|
||||
|
||||
size_t PieceStat::getOrder() const
|
||||
{
|
||||
return _order;
|
||||
}
|
||||
|
||||
class GenPieceStat {
|
||||
private:
|
||||
size_t _index;
|
||||
|
@ -204,15 +175,4 @@ void PieceStatMan::addPieceStats(size_t index)
|
|||
std::rotate(cur, cur+1, to);
|
||||
}
|
||||
|
||||
const std::vector<size_t>& PieceStatMan::getRarerPieceIndexes() const
|
||||
{
|
||||
return _sortedPieceStatIndexes;
|
||||
}
|
||||
|
||||
const std::vector<SharedHandle<PieceStat> >&
|
||||
PieceStatMan::getPieceStats() const
|
||||
{
|
||||
return _pieceStats;
|
||||
}
|
||||
|
||||
} // namespace aria2
|
||||
|
|
|
@ -51,15 +51,38 @@ private:
|
|||
public:
|
||||
PieceStat(size_t index);
|
||||
|
||||
bool operator<(const PieceStat& pieceStat) const;
|
||||
bool operator<(const PieceStat& pieceStat) const
|
||||
{
|
||||
if(_count == pieceStat._count) {
|
||||
return _order < pieceStat._order;
|
||||
} else {
|
||||
return _count < pieceStat._count;
|
||||
}
|
||||
}
|
||||
|
||||
void addCount();
|
||||
void subCount();
|
||||
|
||||
size_t getOrder() const;
|
||||
void setOrder(size_t order);
|
||||
size_t getIndex() const;
|
||||
size_t getCount() const;
|
||||
size_t getOrder() const
|
||||
{
|
||||
return _order;
|
||||
}
|
||||
|
||||
void setOrder(size_t order)
|
||||
{
|
||||
_order = order;
|
||||
}
|
||||
|
||||
size_t getIndex() const
|
||||
{
|
||||
return _index;
|
||||
}
|
||||
|
||||
size_t getCount() const
|
||||
{
|
||||
return _count;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
class PieceStatMan {
|
||||
|
@ -83,9 +106,16 @@ public:
|
|||
const unsigned char* oldBitfield);
|
||||
|
||||
// Returns piece index in rarest first order.
|
||||
const std::vector<size_t>& getRarerPieceIndexes() const;
|
||||
const std::vector<size_t>& getRarerPieceIndexes() const
|
||||
{
|
||||
return _sortedPieceStatIndexes;
|
||||
}
|
||||
|
||||
const std::vector<SharedHandle<PieceStat> >& getPieceStats() const
|
||||
{
|
||||
return _pieceStats;
|
||||
}
|
||||
|
||||
const std::vector<SharedHandle<PieceStat> >& getPieceStats() const;
|
||||
};
|
||||
|
||||
} // namespace aria2
|
||||
|
|
|
@ -238,24 +238,9 @@ void Request::resetRedirectCount()
|
|||
_redirectCount = 0;
|
||||
}
|
||||
|
||||
unsigned int Request::getRedirectCount() const
|
||||
{
|
||||
return _redirectCount;
|
||||
}
|
||||
|
||||
bool Request::isPipeliningHint() const
|
||||
{
|
||||
return _pipeliningHint;
|
||||
}
|
||||
|
||||
void Request::setMaxPipelinedRequest(unsigned int num)
|
||||
{
|
||||
_maxPipelinedRequest = num;
|
||||
}
|
||||
|
||||
unsigned int Request::getMaxPipelinedRequest() const
|
||||
{
|
||||
return _maxPipelinedRequest;
|
||||
}
|
||||
|
||||
} // namespace aria2
|
||||
|
|
|
@ -100,7 +100,10 @@ public:
|
|||
|
||||
void resetRedirectCount();
|
||||
|
||||
unsigned int getRedirectCount() const;
|
||||
unsigned int getRedirectCount() const
|
||||
{
|
||||
return _redirectCount;
|
||||
}
|
||||
|
||||
// Returns URI passed by setUrl()
|
||||
const std::string& getUrl() const { return url; }
|
||||
|
@ -145,11 +148,17 @@ public:
|
|||
_pipeliningHint = pipeliningHint;
|
||||
}
|
||||
|
||||
bool isPipeliningHint() const;
|
||||
bool isPipeliningHint() const
|
||||
{
|
||||
return _pipeliningHint;
|
||||
}
|
||||
|
||||
void setMaxPipelinedRequest(unsigned int num);
|
||||
|
||||
unsigned int getMaxPipelinedRequest() const;
|
||||
unsigned int getMaxPipelinedRequest() const
|
||||
{
|
||||
return _maxPipelinedRequest;
|
||||
}
|
||||
|
||||
void setMethod(const std::string& method) {
|
||||
this->method = method;
|
||||
|
|
|
@ -149,7 +149,7 @@ RequestGroup::RequestGroup(const SharedHandle<Option>& option,
|
|||
|
||||
RequestGroup::~RequestGroup() {}
|
||||
|
||||
SegmentManHandle RequestGroup::initSegmentMan()
|
||||
const SegmentManHandle& RequestGroup::initSegmentMan()
|
||||
{
|
||||
_segmentMan = _segmentManFactory->createNewInstance(_downloadContext,
|
||||
_pieceStorage);
|
||||
|
@ -937,11 +937,6 @@ void RequestGroup::setDiskWriterFactory(const DiskWriterFactoryHandle& diskWrite
|
|||
_diskWriterFactory = diskWriterFactory;
|
||||
}
|
||||
|
||||
DiskWriterFactoryHandle RequestGroup::getDiskWriterFactory() const
|
||||
{
|
||||
return _diskWriterFactory;
|
||||
}
|
||||
|
||||
void RequestGroup::addPostDownloadHandler(const PostDownloadHandlerHandle& handler)
|
||||
{
|
||||
_postDownloadHandlers.push_back(handler);
|
||||
|
@ -962,36 +957,16 @@ void RequestGroup::clearPreDowloadHandler()
|
|||
_preDownloadHandlers.clear();
|
||||
}
|
||||
|
||||
SegmentManHandle RequestGroup::getSegmentMan() const
|
||||
{
|
||||
return _segmentMan;
|
||||
}
|
||||
|
||||
DownloadContextHandle RequestGroup::getDownloadContext() const
|
||||
{
|
||||
return _downloadContext;
|
||||
}
|
||||
|
||||
void RequestGroup::setDownloadContext(const DownloadContextHandle& downloadContext)
|
||||
{
|
||||
_downloadContext = downloadContext;
|
||||
}
|
||||
|
||||
PieceStorageHandle RequestGroup::getPieceStorage() const
|
||||
{
|
||||
return _pieceStorage;
|
||||
}
|
||||
|
||||
void RequestGroup::setPieceStorage(const PieceStorageHandle& pieceStorage)
|
||||
{
|
||||
_pieceStorage = pieceStorage;
|
||||
}
|
||||
|
||||
BtProgressInfoFileHandle RequestGroup::getProgressInfoFile() const
|
||||
{
|
||||
return _progressInfoFile;
|
||||
}
|
||||
|
||||
void RequestGroup::setProgressInfoFile(const BtProgressInfoFileHandle& progressInfoFile)
|
||||
{
|
||||
_progressInfoFile = progressInfoFile;
|
||||
|
@ -1131,11 +1106,6 @@ void RequestGroup::reportDownloadFinished()
|
|||
#endif // ENABLE_BITTORRENT
|
||||
}
|
||||
|
||||
const std::deque<std::string>& RequestGroup::getAcceptFeatures() const
|
||||
{
|
||||
return _acceptFeatures;
|
||||
}
|
||||
|
||||
void RequestGroup::addAcceptFeatureHeader(const std::string& feature)
|
||||
{
|
||||
if(std::find(_acceptFeatures.begin(), _acceptFeatures.end(), feature) == _acceptFeatures.end()) {
|
||||
|
@ -1151,11 +1121,6 @@ void RequestGroup::removeAcceptFeatureHeader(const std::string& feature)
|
|||
}
|
||||
}
|
||||
|
||||
const std::deque<std::string>& RequestGroup::getAcceptTypes() const
|
||||
{
|
||||
return _acceptTypes;
|
||||
}
|
||||
|
||||
void RequestGroup::addAcceptType(const std::string& type)
|
||||
{
|
||||
if(std::find(_acceptTypes.begin(), _acceptTypes.end(), type) == _acceptTypes.end()) {
|
||||
|
@ -1206,21 +1171,11 @@ void RequestGroup::increaseAndValidateFileNotFoundCount()
|
|||
}
|
||||
}
|
||||
|
||||
unsigned int RequestGroup::getNumConcurrentCommand() const
|
||||
{
|
||||
return _numConcurrentCommand;
|
||||
}
|
||||
|
||||
void RequestGroup::markInMemoryDownload()
|
||||
{
|
||||
_inMemoryDownload = true;
|
||||
}
|
||||
|
||||
bool RequestGroup::inMemoryDownload() const
|
||||
{
|
||||
return _inMemoryDownload;
|
||||
}
|
||||
|
||||
void RequestGroup::tuneDownloadCommand(DownloadCommand* command)
|
||||
{
|
||||
_uriSelector->tuneDownloadCommand(_uris, command);
|
||||
|
@ -1231,11 +1186,6 @@ void RequestGroup::addURIResult(std::string uri, DownloadResult::RESULT result)
|
|||
_uriResults.push_back(URIResult(uri, result));
|
||||
}
|
||||
|
||||
const std::deque<URIResult>& RequestGroup::getURIResults() const
|
||||
{
|
||||
return _uriResults;
|
||||
}
|
||||
|
||||
class FindURIResultByResult {
|
||||
private:
|
||||
DownloadResult::RESULT _r;
|
||||
|
@ -1263,21 +1213,11 @@ void RequestGroup::setTimeout(time_t timeout)
|
|||
_timeout = timeout;
|
||||
}
|
||||
|
||||
time_t RequestGroup::getTimeout() const
|
||||
{
|
||||
return _timeout;
|
||||
}
|
||||
|
||||
void RequestGroup::setMaxTries(unsigned int maxTries)
|
||||
{
|
||||
_maxTries = maxTries;
|
||||
}
|
||||
|
||||
unsigned int RequestGroup::getMaxTries() const
|
||||
{
|
||||
return _maxTries;
|
||||
}
|
||||
|
||||
bool RequestGroup::doesDownloadSpeedExceed()
|
||||
{
|
||||
return _maxDownloadSpeedLimit > 0 &&
|
||||
|
|
|
@ -193,9 +193,12 @@ public:
|
|||
* Reinitializes SegmentMan based on current property values and
|
||||
* returns new one.
|
||||
*/
|
||||
SharedHandle<SegmentMan> initSegmentMan();
|
||||
const SharedHandle<SegmentMan>& initSegmentMan();
|
||||
|
||||
SharedHandle<SegmentMan> getSegmentMan() const;
|
||||
const SharedHandle<SegmentMan>& getSegmentMan() const
|
||||
{
|
||||
return _segmentMan;
|
||||
}
|
||||
|
||||
// Returns first bootstrap commands to initiate a download.
|
||||
// If this is HTTP/FTP download and file size is unknown, only 1 command
|
||||
|
@ -260,7 +263,10 @@ public:
|
|||
_numConcurrentCommand = num;
|
||||
}
|
||||
|
||||
unsigned int getNumConcurrentCommand() const;
|
||||
unsigned int getNumConcurrentCommand() const
|
||||
{
|
||||
return _numConcurrentCommand;
|
||||
}
|
||||
|
||||
int32_t getGID() const
|
||||
{
|
||||
|
@ -269,15 +275,24 @@ public:
|
|||
|
||||
TransferStat calculateStat();
|
||||
|
||||
SharedHandle<DownloadContext> getDownloadContext() const;
|
||||
const SharedHandle<DownloadContext>& getDownloadContext() const
|
||||
{
|
||||
return _downloadContext;
|
||||
}
|
||||
|
||||
void setDownloadContext(const SharedHandle<DownloadContext>& downloadContext);
|
||||
|
||||
SharedHandle<PieceStorage> getPieceStorage() const;
|
||||
const SharedHandle<PieceStorage>& getPieceStorage() const
|
||||
{
|
||||
return _pieceStorage;
|
||||
}
|
||||
|
||||
void setPieceStorage(const SharedHandle<PieceStorage>& pieceStorage);
|
||||
|
||||
SharedHandle<BtProgressInfoFile> getProgressInfoFile() const;
|
||||
const SharedHandle<BtProgressInfoFile>& getProgressInfoFile() const
|
||||
{
|
||||
return _progressInfoFile;
|
||||
}
|
||||
|
||||
void setProgressInfoFile(const SharedHandle<BtProgressInfoFile>& progressInfoFile);
|
||||
|
||||
|
@ -299,7 +314,10 @@ public:
|
|||
// TODO is it better to move the following 2 methods to SingleFileDownloadContext?
|
||||
void setDiskWriterFactory(const SharedHandle<DiskWriterFactory>& diskWriterFactory);
|
||||
|
||||
SharedHandle<DiskWriterFactory> getDiskWriterFactory() const;
|
||||
const SharedHandle<DiskWriterFactory>& getDiskWriterFactory() const
|
||||
{
|
||||
return _diskWriterFactory;
|
||||
}
|
||||
|
||||
void setFileAllocationEnabled(bool f)
|
||||
{
|
||||
|
@ -344,7 +362,10 @@ public:
|
|||
|
||||
void addURIResult(std::string uri, DownloadResult::RESULT result);
|
||||
|
||||
const std::deque<URIResult>& getURIResults() const;
|
||||
const std::deque<URIResult>& getURIResults() const
|
||||
{
|
||||
return _uriResults;
|
||||
}
|
||||
|
||||
// Extracts URIResult whose _result is r and stores them into res.
|
||||
// The extracted URIResults are removed from _uriResults.
|
||||
|
@ -420,13 +441,19 @@ public:
|
|||
|
||||
void reportDownloadFinished();
|
||||
|
||||
const std::deque<std::string>& getAcceptFeatures() const;
|
||||
const std::deque<std::string>& getAcceptFeatures() const
|
||||
{
|
||||
return _acceptFeatures;
|
||||
}
|
||||
|
||||
void addAcceptFeatureHeader(const std::string& feature);
|
||||
|
||||
void removeAcceptFeatureHeader(const std::string& feature);
|
||||
|
||||
const std::deque<std::string>& getAcceptTypes() const;
|
||||
const std::deque<std::string>& getAcceptTypes() const
|
||||
{
|
||||
return _acceptTypes;
|
||||
}
|
||||
|
||||
void addAcceptType(const std::string& type);
|
||||
|
||||
|
@ -446,17 +473,26 @@ public:
|
|||
void markInMemoryDownload();
|
||||
|
||||
// Returns inMemoryDownload flag.
|
||||
bool inMemoryDownload() const;
|
||||
bool inMemoryDownload() const
|
||||
{
|
||||
return _inMemoryDownload;
|
||||
}
|
||||
|
||||
void tuneDownloadCommand(DownloadCommand* command);
|
||||
|
||||
void setTimeout(time_t timeout);
|
||||
|
||||
time_t getTimeout() const;
|
||||
time_t getTimeout() const
|
||||
{
|
||||
return _timeout;
|
||||
}
|
||||
|
||||
void setMaxTries(unsigned int maxTries);
|
||||
|
||||
unsigned int getMaxTries() const;
|
||||
unsigned int getMaxTries() const
|
||||
{
|
||||
return _maxTries;
|
||||
}
|
||||
|
||||
// Returns true if current download speed exceeds
|
||||
// _maxDownloadSpeedLimit. Always returns false if
|
||||
|
|
|
@ -131,12 +131,6 @@ RequestGroupHandle RequestGroupMan::getRequestGroup(size_t index) const
|
|||
}
|
||||
}
|
||||
|
||||
const std::deque<SharedHandle<RequestGroup> >&
|
||||
RequestGroupMan::getRequestGroups() const
|
||||
{
|
||||
return _requestGroups;
|
||||
}
|
||||
|
||||
template<typename Iterator>
|
||||
static Iterator findByGID(Iterator first, Iterator last, int32_t gid)
|
||||
{
|
||||
|
@ -160,12 +154,6 @@ RequestGroupMan::findRequestGroup(int32_t gid) const
|
|||
}
|
||||
}
|
||||
|
||||
const std::deque<SharedHandle<RequestGroup> >&
|
||||
RequestGroupMan::getReservedGroups() const
|
||||
{
|
||||
return _reservedGroups;
|
||||
}
|
||||
|
||||
SharedHandle<RequestGroup>
|
||||
RequestGroupMan::findReservedGroup(int32_t gid) const
|
||||
{
|
||||
|
@ -723,12 +711,6 @@ TransferStat RequestGroupMan::calculateStat()
|
|||
return s;
|
||||
}
|
||||
|
||||
const std::deque<SharedHandle<DownloadResult> >&
|
||||
RequestGroupMan::getDownloadResults() const
|
||||
{
|
||||
return _downloadResults;
|
||||
}
|
||||
|
||||
SharedHandle<DownloadResult>
|
||||
RequestGroupMan::findDownloadResult(int32_t gid) const
|
||||
{
|
||||
|
|
|
@ -110,11 +110,17 @@ public:
|
|||
|
||||
SharedHandle<RequestGroup> getRequestGroup(size_t index) const;
|
||||
|
||||
const std::deque<SharedHandle<RequestGroup> >& getRequestGroups() const;
|
||||
const std::deque<SharedHandle<RequestGroup> >& getRequestGroups() const
|
||||
{
|
||||
return _requestGroups;
|
||||
}
|
||||
|
||||
SharedHandle<RequestGroup> findRequestGroup(int32_t gid) const;
|
||||
|
||||
const std::deque<SharedHandle<RequestGroup> >& getReservedGroups() const;
|
||||
const std::deque<SharedHandle<RequestGroup> >& getReservedGroups() const
|
||||
{
|
||||
return _reservedGroups;
|
||||
}
|
||||
|
||||
SharedHandle<RequestGroup> findReservedGroup(int32_t gid) const;
|
||||
|
||||
|
@ -164,8 +170,10 @@ public:
|
|||
|
||||
DownloadStat getDownloadStat() const;
|
||||
|
||||
const std::deque<SharedHandle<DownloadResult> >&
|
||||
getDownloadResults() const;
|
||||
const std::deque<SharedHandle<DownloadResult> >& getDownloadResults() const
|
||||
{
|
||||
return _downloadResults;
|
||||
}
|
||||
|
||||
SharedHandle<DownloadResult> findDownloadResult(int32_t gid) const;
|
||||
|
||||
|
|
|
@ -107,9 +107,4 @@ bool RequestSlot::isNull(const RequestSlot& requestSlot) {
|
|||
requestSlot.length == 0;
|
||||
}
|
||||
|
||||
SharedHandle<Piece> RequestSlot::getPiece() const
|
||||
{
|
||||
return _piece;
|
||||
}
|
||||
|
||||
} // namespace aria2
|
||||
|
|
|
@ -36,9 +36,11 @@
|
|||
#define _D_REQUEST_SLOT_H_
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#include <deque>
|
||||
|
||||
#include "TimeA2.h"
|
||||
#include "Piece.h"
|
||||
#include <deque>
|
||||
|
||||
namespace aria2 {
|
||||
|
||||
|
@ -94,7 +96,10 @@ public:
|
|||
size_t getBlockIndex() const { return blockIndex; }
|
||||
void setBlockIndex(size_t blockIndex) { this->blockIndex = blockIndex; }
|
||||
|
||||
SharedHandle<Piece> getPiece() const;
|
||||
const SharedHandle<Piece>& getPiece() const
|
||||
{
|
||||
return _piece;
|
||||
}
|
||||
|
||||
static RequestSlot nullSlot;
|
||||
|
||||
|
|
|
@ -295,11 +295,6 @@ PeerStatHandle SegmentMan::getPeerStat(cuid_t cuid) const
|
|||
}
|
||||
}
|
||||
|
||||
const std::deque<SharedHandle<PeerStat> >& SegmentMan::getPeerStats() const
|
||||
{
|
||||
return peerStats;
|
||||
}
|
||||
|
||||
unsigned int SegmentMan::calculateDownloadSpeed()
|
||||
{
|
||||
unsigned int speed = 0;
|
||||
|
|
|
@ -183,8 +183,10 @@ public:
|
|||
*/
|
||||
SharedHandle<PeerStat> getPeerStat(cuid_t cuid) const;
|
||||
|
||||
|
||||
const std::deque<SharedHandle<PeerStat> >& getPeerStats() const;
|
||||
const std::deque<SharedHandle<PeerStat> >& getPeerStats() const
|
||||
{
|
||||
return peerStats;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns current download speed in bytes per sec.
|
||||
|
|
|
@ -48,36 +48,6 @@ namespace aria2 {
|
|||
SelectEventPoll::CommandEvent::CommandEvent(Command* command, int events):
|
||||
_command(command), _events(events) {}
|
||||
|
||||
bool SelectEventPoll::CommandEvent::operator==(const CommandEvent& commandEvent) const
|
||||
{
|
||||
return _command == commandEvent._command;
|
||||
}
|
||||
|
||||
Command* SelectEventPoll::CommandEvent::getCommand() const
|
||||
{
|
||||
return _command;
|
||||
}
|
||||
|
||||
int SelectEventPoll::CommandEvent::getEvents() const
|
||||
{
|
||||
return _events;
|
||||
}
|
||||
|
||||
void SelectEventPoll::CommandEvent::addEvents(int events)
|
||||
{
|
||||
_events |= events;
|
||||
}
|
||||
|
||||
void SelectEventPoll::CommandEvent::removeEvents(int events)
|
||||
{
|
||||
_events &= (~events);
|
||||
}
|
||||
|
||||
bool SelectEventPoll::CommandEvent::eventsEmpty() const
|
||||
{
|
||||
return _events == 0;
|
||||
}
|
||||
|
||||
void SelectEventPoll::CommandEvent::processEvents(int events)
|
||||
{
|
||||
if((_events&events) ||
|
||||
|
@ -100,16 +70,6 @@ void SelectEventPoll::CommandEvent::processEvents(int events)
|
|||
|
||||
SelectEventPoll::SocketEntry::SocketEntry(sock_t socket):_socket(socket) {}
|
||||
|
||||
bool SelectEventPoll::SocketEntry::operator==(const SocketEntry& entry) const
|
||||
{
|
||||
return _socket == entry._socket;
|
||||
}
|
||||
|
||||
bool SelectEventPoll::SocketEntry::operator<(const SocketEntry& entry) const
|
||||
{
|
||||
return _socket < entry._socket;
|
||||
}
|
||||
|
||||
void SelectEventPoll::SocketEntry::addCommandEvent
|
||||
(Command* command, int events)
|
||||
{
|
||||
|
@ -146,16 +106,6 @@ void SelectEventPoll::SocketEntry::processEvents(int events)
|
|||
events));
|
||||
}
|
||||
|
||||
sock_t SelectEventPoll::SocketEntry::getSocket() const
|
||||
{
|
||||
return _socket;
|
||||
}
|
||||
|
||||
bool SelectEventPoll::SocketEntry::eventEmpty() const
|
||||
{
|
||||
return _commandEvents.empty();
|
||||
}
|
||||
|
||||
int accumulateEvent(int events, const SelectEventPoll::CommandEvent& event)
|
||||
{
|
||||
return events|event.getEvents();
|
||||
|
@ -174,12 +124,6 @@ SelectEventPoll::AsyncNameResolverEntry::AsyncNameResolverEntry
|
|||
(const SharedHandle<AsyncNameResolver>& nameResolver, Command* command):
|
||||
_nameResolver(nameResolver), _command(command) {}
|
||||
|
||||
bool SelectEventPoll::AsyncNameResolverEntry::operator==
|
||||
(const AsyncNameResolverEntry& entry)
|
||||
{
|
||||
return _nameResolver == entry._nameResolver &&
|
||||
_command == entry._command;
|
||||
}
|
||||
int SelectEventPoll::AsyncNameResolverEntry::getFds
|
||||
(fd_set* rfdsPtr, fd_set* wfdsPtr)
|
||||
{
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue