mirror of https://github.com/aria2/aria2
Removed trailing spaces
parent
390b2e546e
commit
8b0c701266
|
@ -190,7 +190,7 @@ void test_wslay_event_send_fragmented_msg_with_ctrl(void)
|
|||
memset(&acc, 0, sizeof(acc));
|
||||
ud.acc = &acc;
|
||||
wslay_event_context_server_init(&ctx, &callbacks, &ud);
|
||||
|
||||
|
||||
memset(&arg, 0, sizeof(arg));
|
||||
arg.opcode = WSLAY_TEXT_FRAME;
|
||||
arg.source.data = &df;
|
||||
|
@ -231,7 +231,7 @@ void test_wslay_event_send_ctrl_msg_first(void)
|
|||
memset(&acc, 0, sizeof(acc));
|
||||
ud.acc = &acc;
|
||||
wslay_event_context_server_init(&ctx, &callbacks, &ud);
|
||||
|
||||
|
||||
memset(&arg, 0, sizeof(arg));
|
||||
arg.opcode = WSLAY_PING;
|
||||
arg.msg_length = 0;
|
||||
|
|
|
@ -142,7 +142,7 @@ void AbstractDiskWriter::createFile(int addFlags)
|
|||
filename_.c_str(),
|
||||
util::safeStrerror(errNum).c_str()),
|
||||
error_code::FILE_CREATE_ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ssize_t AbstractDiskWriter::writeDataInternal(const unsigned char* data,
|
||||
|
|
|
@ -80,7 +80,7 @@ public:
|
|||
virtual void allocate(int64_t offset, int64_t length);
|
||||
|
||||
virtual int64_t size();
|
||||
|
||||
|
||||
virtual void enableReadOnly();
|
||||
|
||||
virtual void disableReadOnly();
|
||||
|
|
|
@ -70,7 +70,7 @@ public:
|
|||
virtual int64_t size();
|
||||
|
||||
virtual void truncate(int64_t length);
|
||||
|
||||
|
||||
virtual SharedHandle<FileAllocationIterator> fileAllocationIterator();
|
||||
|
||||
// Make sure that DiskWriter is set before calling this function.
|
||||
|
@ -78,11 +78,11 @@ public:
|
|||
|
||||
// Make sure that DiskWriter is set before calling this function.
|
||||
virtual void disableReadOnly();
|
||||
|
||||
|
||||
virtual bool isReadOnlyEnabled() const { return readOnly_; }
|
||||
|
||||
virtual void enableMmap();
|
||||
|
||||
|
||||
virtual void cutTrailingGarbage();
|
||||
|
||||
virtual const std::string& getFilePath() = 0;
|
||||
|
|
|
@ -68,7 +68,7 @@ public:
|
|||
time_t interval);
|
||||
|
||||
virtual ~ActivePeerConnectionCommand();
|
||||
|
||||
|
||||
virtual bool execute();
|
||||
|
||||
void connectToPeer(const SharedHandle<Peer>& peer);
|
||||
|
|
|
@ -86,7 +86,7 @@ void AdaptiveFileAllocationIterator::allocateChunk()
|
|||
allocator_->allocateChunk();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool AdaptiveFileAllocationIterator::finished()
|
||||
{
|
||||
if(!allocator_) {
|
||||
|
|
|
@ -58,7 +58,7 @@ public:
|
|||
virtual ~AdaptiveFileAllocationIterator();
|
||||
|
||||
virtual void allocateChunk();
|
||||
|
||||
|
||||
virtual bool finished();
|
||||
|
||||
virtual int64_t getCurrentLength();
|
||||
|
|
|
@ -58,10 +58,10 @@
|
|||
|
||||
namespace aria2 {
|
||||
|
||||
/* In that URI Selector, select method returns one of the bests
|
||||
* mirrors for first and reserved connections. For supplementary
|
||||
* ones, it returns mirrors which has not been tested yet, and
|
||||
* if each of them already tested, returns mirrors which has to
|
||||
/* In that URI Selector, select method returns one of the bests
|
||||
* mirrors for first and reserved connections. For supplementary
|
||||
* ones, it returns mirrors which has not been tested yet, and
|
||||
* if each of them already tested, returns mirrors which has to
|
||||
* be tested again. Otherwise, it doesn't return anymore mirrors.
|
||||
*/
|
||||
|
||||
|
@ -87,7 +87,7 @@ std::string AdaptiveURISelector::select
|
|||
// failed uris that may succeed with more permissive values
|
||||
mayRetryWithIncreasedTimeout(fileEntry);
|
||||
}
|
||||
|
||||
|
||||
std::string selected = selectOne(uris);
|
||||
|
||||
if(selected != A2STR::NIL)
|
||||
|
@ -128,12 +128,12 @@ std::string AdaptiveURISelector::selectOne(const std::deque<std::string>& uris)
|
|||
const size_t numPieces =
|
||||
requestGroup_->getDownloadContext()->getNumPieces();
|
||||
|
||||
bool reservedContext = numPieces > 0 &&
|
||||
bool reservedContext = numPieces > 0 &&
|
||||
static_cast<size_t>(nbConnections_) > std::min
|
||||
(numPieces,
|
||||
static_cast<size_t>(requestGroup_->getNumConcurrentCommand()));
|
||||
bool selectBest = numPieces == 0 || reservedContext;
|
||||
|
||||
|
||||
if(numPieces > 0)
|
||||
++nbConnections_;
|
||||
|
||||
|
@ -148,7 +148,7 @@ std::string AdaptiveURISelector::selectOne(const std::deque<std::string>& uris)
|
|||
return notTested;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(!selectBest && nbConnections_ > 1 && nbServerToEvaluate_ > 0) {
|
||||
nbServerToEvaluate_--;
|
||||
std::string notTested = getFirstNotTestedUri(uris);
|
||||
|
@ -184,7 +184,7 @@ std::string AdaptiveURISelector::getBestMirror
|
|||
int max = getMaxDownloadSpeed(uris);
|
||||
int min = max-(int)(max*0.25);
|
||||
std::deque<std::string> bests = getUrisBySpeed(uris, min);
|
||||
|
||||
|
||||
if (bests.size() < 2) {
|
||||
std::string uri = getMaxDownloadSpeedUri(uris);
|
||||
A2_LOG_DEBUG(fmt("AdaptiveURISelector: choosing the best mirror :"
|
||||
|
|
|
@ -70,7 +70,7 @@ private:
|
|||
int getNbTestedServers(const std::deque<std::string>& uris) const;
|
||||
std::string getBestMirror(const std::deque<std::string>& uris) const;
|
||||
public:
|
||||
AdaptiveURISelector(const SharedHandle<ServerStatMan>& serverStatMan,
|
||||
AdaptiveURISelector(const SharedHandle<ServerStatMan>& serverStatMan,
|
||||
RequestGroup* requestGroup);
|
||||
|
||||
virtual ~AdaptiveURISelector();
|
||||
|
|
|
@ -266,7 +266,7 @@ bool getSparseMissingUnusedIndex
|
|||
maxRange = currentRange;
|
||||
}
|
||||
nextIndex = currentRange.endIndex;
|
||||
|
||||
|
||||
}
|
||||
if(maxRange.getSize()) {
|
||||
if(maxRange.startIndex == 0) {
|
||||
|
@ -897,7 +897,7 @@ BitfieldMan::Range::Range(size_t startIndex, size_t endIndex)
|
|||
startIndex(startIndex),
|
||||
endIndex(endIndex)
|
||||
{}
|
||||
|
||||
|
||||
size_t BitfieldMan::Range::getSize() const
|
||||
{
|
||||
return endIndex-startIndex;
|
||||
|
@ -912,7 +912,7 @@ bool BitfieldMan::Range::operator<(const Range& range) const
|
|||
{
|
||||
return getSize() < range.getSize();
|
||||
}
|
||||
|
||||
|
||||
bool BitfieldMan::Range::operator==(const Range& range) const
|
||||
{
|
||||
return getSize() == range.getSize();
|
||||
|
|
|
@ -80,7 +80,7 @@ public:
|
|||
Range(size_t startIndex = 0, size_t endIndex = 0);
|
||||
size_t getSize() const;
|
||||
size_t getMidIndex() const;
|
||||
bool operator<(const Range& range) const;
|
||||
bool operator<(const Range& range) const;
|
||||
bool operator==(const Range& range) const;
|
||||
};
|
||||
public:
|
||||
|
@ -248,7 +248,7 @@ public:
|
|||
|
||||
// Clears filter and disables filter
|
||||
void clearFilter();
|
||||
|
||||
|
||||
void enableFilter();
|
||||
void disableFilter();
|
||||
bool isFilterEnabled() const
|
||||
|
|
|
@ -150,7 +150,7 @@ void BtLeecherStateChoke::plannedOptimisticUnchoke
|
|||
{
|
||||
std::for_each(peerEntries.begin(), peerEntries.end(),
|
||||
std::mem_fun_ref(&PeerEntry::disableOptUnchoking));
|
||||
|
||||
|
||||
std::vector<PeerEntry>::iterator i =
|
||||
std::partition(peerEntries.begin(), peerEntries.end(),
|
||||
PeerFilter(true, true));
|
||||
|
@ -168,7 +168,7 @@ void BtLeecherStateChoke::regularUnchoke(std::vector<PeerEntry>& peerEntries)
|
|||
std::vector<PeerEntry>::iterator rest =
|
||||
std::partition(peerEntries.begin(), peerEntries.end(),
|
||||
std::mem_fun_ref(&PeerEntry::isRegularUnchoker));
|
||||
|
||||
|
||||
std::sort(peerEntries.begin(), rest);
|
||||
|
||||
// the number of regular unchokers
|
||||
|
@ -218,7 +218,7 @@ BtLeecherStateChoke::executeChoke
|
|||
peerEntries.erase(std::remove_if(peerEntries.begin(), peerEntries.end(),
|
||||
std::mem_fun_ref(&PeerEntry::isSnubbing)),
|
||||
peerEntries.end());
|
||||
|
||||
|
||||
std::for_each(peerEntries.begin(), peerEntries.end(),
|
||||
std::mem_fun_ref(&PeerEntry::enableChokingRequired));
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ BtRegistry::getDownloadContext(const std::string& infoHash) const
|
|||
infoHash) {
|
||||
return (*i).second->downloadContext;
|
||||
}
|
||||
}
|
||||
}
|
||||
return getNull<DownloadContext>();
|
||||
}
|
||||
|
||||
|
|
|
@ -174,13 +174,13 @@ BtSeederStateChoke::executeChoke
|
|||
|
||||
std::transform(peerSet.begin(), peerSet.end(),
|
||||
std::back_inserter(peerEntries), GenPeerEntry());
|
||||
|
||||
|
||||
peerEntries.erase(std::remove_if(peerEntries.begin(), peerEntries.end(),
|
||||
NotInterestedPeer()),
|
||||
peerEntries.end());
|
||||
|
||||
unchoke(peerEntries);
|
||||
|
||||
|
||||
if(++round_ == 3) {
|
||||
round_ = 0;
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ private:
|
|||
Timer lastAmUnchoking_;
|
||||
bool recentUnchoking_;
|
||||
int uploadSpeed_;
|
||||
|
||||
|
||||
const static time_t TIME_FRAME = 20;
|
||||
public:
|
||||
PeerEntry(const SharedHandle<Peer>& peer);
|
||||
|
|
|
@ -114,7 +114,7 @@ void BtSetup::setup(std::vector<Command*>& commands,
|
|||
c->setPieceStorage(pieceStorage);
|
||||
c->setBtRuntime(btRuntime);
|
||||
c->setBtAnnounce(btAnnounce);
|
||||
|
||||
|
||||
commands.push_back(c);
|
||||
}
|
||||
if(!metadataGetMode) {
|
||||
|
@ -122,7 +122,7 @@ void BtSetup::setup(std::vector<Command*>& commands,
|
|||
new PeerChokeCommand(e->newCUID(), e);
|
||||
c->setPeerStorage(peerStorage);
|
||||
c->setBtRuntime(btRuntime);
|
||||
|
||||
|
||||
commands.push_back(c);
|
||||
}
|
||||
{
|
||||
|
@ -133,7 +133,7 @@ void BtSetup::setup(std::vector<Command*>& commands,
|
|||
c->setPieceStorage(pieceStorage);
|
||||
c->setPeerStorage(peerStorage);
|
||||
c->setBtAnnounce(btAnnounce);
|
||||
|
||||
|
||||
commands.push_back(c);
|
||||
}
|
||||
|
||||
|
@ -261,7 +261,7 @@ void BtSetup::setup(std::vector<Command*>& commands,
|
|||
if(btReg->getLpdMessageReceiver()) {
|
||||
const unsigned char* infoHash =
|
||||
bittorrent::getInfoHash(requestGroup->getDownloadContext());
|
||||
A2_LOG_INFO("Initializing LpdMessageDispatcher.");
|
||||
A2_LOG_INFO("Initializing LpdMessageDispatcher.");
|
||||
SharedHandle<LpdMessageDispatcher> dispatcher
|
||||
(new LpdMessageDispatcher
|
||||
(std::string(&infoHash[0], &infoHash[INFO_HASH_LENGTH]),
|
||||
|
|
|
@ -49,7 +49,7 @@ class BtRuntime;
|
|||
class BtStopDownloadCommand:public TimeBasedCommand {
|
||||
private:
|
||||
RequestGroup* requestGroup_;
|
||||
|
||||
|
||||
time_t timeout_;
|
||||
|
||||
Timer checkPoint_;
|
||||
|
|
|
@ -59,7 +59,7 @@ void Checksum::setDigest(const std::string& digest)
|
|||
{
|
||||
digest_ = digest;
|
||||
}
|
||||
|
||||
|
||||
void Checksum::setHashType(const std::string& hashType)
|
||||
{
|
||||
hashType_ = hashType;
|
||||
|
|
|
@ -58,7 +58,7 @@ public:
|
|||
{
|
||||
return digest_;
|
||||
}
|
||||
|
||||
|
||||
void setHashType(const std::string& type);
|
||||
const std::string& getHashType() const
|
||||
{
|
||||
|
|
|
@ -65,7 +65,7 @@ public:
|
|||
size_t countPieceHash() const;
|
||||
|
||||
const std::string& getPieceHash(size_t index) const;
|
||||
|
||||
|
||||
void setPieceHashes(const std::vector<std::string>& pieceHashes);
|
||||
const std::vector<std::string>& getPieceHashes() const
|
||||
{
|
||||
|
|
|
@ -57,7 +57,7 @@ public:
|
|||
(const SharedHandle<BinaryStream>& out,
|
||||
const SharedHandle<Segment>& segment,
|
||||
const unsigned char* inbuf, size_t inlen);
|
||||
|
||||
|
||||
virtual bool finished();
|
||||
|
||||
virtual void release();
|
||||
|
|
|
@ -417,7 +417,7 @@ bool CookieStorage::saveNsFormat(const std::string& filename)
|
|||
if(fp.close() == EOF) {
|
||||
A2_LOG_ERROR(fmt("Failed to save cookies to %s", filename.c_str()));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(File(tempfilename).renameTo(filename)) {
|
||||
return true;
|
||||
|
|
|
@ -157,7 +157,7 @@ public:
|
|||
// method returns true. Otherwise, this method returns false. now
|
||||
// is used as creation time and last access time.
|
||||
bool load(const std::string& filename, time_t now);
|
||||
|
||||
|
||||
// Saves Cookies in Netspace format which is used in
|
||||
// Firefox1.2/Netscape/Mozilla. If Cookies are successfully saved,
|
||||
// this method returns true, otherwise returns false.
|
||||
|
@ -165,7 +165,7 @@ public:
|
|||
|
||||
// Returns the number of cookies this object stores.
|
||||
size_t size() const;
|
||||
|
||||
|
||||
// Returns true if this object contains a cookie x where x == cookie
|
||||
// satisfies.
|
||||
bool contains(const Cookie& cookie) const;
|
||||
|
|
|
@ -83,7 +83,7 @@ public:
|
|||
}
|
||||
|
||||
void setMessageDispatcher(DHTMessageDispatcher* dispatcher);
|
||||
|
||||
|
||||
DHTMessageFactory* getMessageFactory() const
|
||||
{
|
||||
return factory_;
|
||||
|
|
|
@ -68,9 +68,9 @@ private:
|
|||
unsigned char targetID_[DHT_ID_LENGTH];
|
||||
|
||||
std::deque<SharedHandle<DHTNodeLookupEntry> > entries_;
|
||||
|
||||
|
||||
size_t inFlightMessage_;
|
||||
|
||||
|
||||
template<typename Container>
|
||||
void toEntries
|
||||
(Container& entries, const std::vector<SharedHandle<DHTNode> >& nodes) const
|
||||
|
@ -130,12 +130,12 @@ protected:
|
|||
virtual void getNodesFromMessage
|
||||
(std::vector<SharedHandle<DHTNode> >& nodes,
|
||||
const ResponseMessage* message) = 0;
|
||||
|
||||
|
||||
virtual void onReceivedInternal
|
||||
(const ResponseMessage* message) {}
|
||||
|
||||
|
||||
virtual bool needsAdditionalOutgoingMessage() { return true; }
|
||||
|
||||
|
||||
virtual void onFinish() {}
|
||||
|
||||
virtual SharedHandle<DHTMessage> createMessage
|
||||
|
|
|
@ -51,7 +51,7 @@ class DHTTaskQueue;
|
|||
class DHTAbstractTask:public DHTTask {
|
||||
private:
|
||||
bool finished_;
|
||||
|
||||
|
||||
SharedHandle<DHTNode> localNode_;
|
||||
|
||||
DHTRoutingTable* routingTable_;
|
||||
|
@ -59,7 +59,7 @@ private:
|
|||
DHTMessageDispatcher* dispatcher_;
|
||||
|
||||
DHTMessageFactory* factory_;
|
||||
|
||||
|
||||
DHTTaskQueue* taskQueue_;
|
||||
protected:
|
||||
void setFinished(bool f)
|
||||
|
|
|
@ -70,7 +70,7 @@ public:
|
|||
virtual void doReceivedAction();
|
||||
|
||||
virtual SharedHandle<Dict> getArgument();
|
||||
|
||||
|
||||
virtual const std::string& getMessageType() const;
|
||||
|
||||
virtual void validate() const;
|
||||
|
|
|
@ -49,7 +49,7 @@ private:
|
|||
int family_;
|
||||
|
||||
SharedHandle<DHTNode> localNode_;
|
||||
|
||||
|
||||
SharedHandle<DHTRoutingTable> routingTable_;
|
||||
|
||||
void save();
|
||||
|
|
|
@ -202,7 +202,7 @@ SharedHandle<DHTBucket> DHTBucket::split()
|
|||
assert(rBucket->addNode(*i));
|
||||
} else {
|
||||
lNodes.push_back(*i);
|
||||
}
|
||||
}
|
||||
}
|
||||
nodes_ = lNodes;
|
||||
// TODO create toString() and use it.
|
||||
|
@ -220,7 +220,7 @@ SharedHandle<DHTBucket> DHTBucket::split()
|
|||
void DHTBucket::getGoodNodes
|
||||
(std::vector<SharedHandle<DHTNode> >& goodNodes) const
|
||||
{
|
||||
goodNodes.insert(goodNodes.end(), nodes_.begin(), nodes_.end());
|
||||
goodNodes.insert(goodNodes.end(), nodes_.begin(), nodes_.end());
|
||||
goodNodes.erase(std::remove_if(goodNodes.begin(), goodNodes.end(),
|
||||
mem_fun_sh(&DHTNode::isBad)), goodNodes.end());
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ public:
|
|||
void cacheNode(const SharedHandle<DHTNode>& node);
|
||||
|
||||
bool splitAllowed() const;
|
||||
|
||||
|
||||
size_t getPrefixLength() const
|
||||
{
|
||||
return prefixLength_;
|
||||
|
|
|
@ -61,7 +61,7 @@ public:
|
|||
* given, the socket is associated to the address.
|
||||
*/
|
||||
bool bind(uint16_t& port, const std::string& addr, SegList<int>& sgl);
|
||||
|
||||
|
||||
/**
|
||||
* Binds port. The port number specified by port is used to bind.
|
||||
* If successful, the binded port is assigned to port and returns
|
||||
|
|
|
@ -128,7 +128,7 @@ bool DHTEntryPointNameResolveCommand::execute()
|
|||
try {
|
||||
std::vector<std::string> addrs;
|
||||
res.resolve(addrs, hostname);
|
||||
|
||||
|
||||
std::pair<std::string, uint16_t> p(addrs.front(),
|
||||
entryPoints_.front().second);
|
||||
resolvedEntryPoints_.push_back(p);
|
||||
|
@ -156,7 +156,7 @@ void DHTEntryPointNameResolveCommand::addPingTask
|
|||
SharedHandle<DHTNode> entryNode(new DHTNode());
|
||||
entryNode->setIPAddress(addr.first);
|
||||
entryNode->setPort(addr.second);
|
||||
|
||||
|
||||
taskQueue_->addPeriodicTask1(taskFactory_->createPingTask(entryNode, 10));
|
||||
}
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ public:
|
|||
virtual void doReceivedAction();
|
||||
|
||||
virtual SharedHandle<Dict> getArgument();
|
||||
|
||||
|
||||
virtual const std::string& getMessageType() const;
|
||||
|
||||
const unsigned char* getTargetNodeID() const
|
||||
|
|
|
@ -58,7 +58,7 @@ public:
|
|||
virtual void doReceivedAction();
|
||||
|
||||
virtual SharedHandle<Dict> getResponse();
|
||||
|
||||
|
||||
virtual const std::string& getMessageType() const;
|
||||
|
||||
virtual void accept(DHTMessageCallback* callback);
|
||||
|
@ -72,9 +72,9 @@ public:
|
|||
(const std::vector<SharedHandle<DHTNode> >& closestKNodes);
|
||||
|
||||
static const std::string FIND_NODE;
|
||||
|
||||
|
||||
static const std::string NODES;
|
||||
|
||||
|
||||
static const std::string NODES6;
|
||||
};
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ public:
|
|||
virtual void doReceivedAction();
|
||||
|
||||
virtual SharedHandle<Dict> getArgument();
|
||||
|
||||
|
||||
virtual const std::string& getMessageType() const;
|
||||
|
||||
const unsigned char* getInfoHash() const
|
||||
|
|
|
@ -93,7 +93,7 @@ public:
|
|||
{
|
||||
values_ = peers;
|
||||
}
|
||||
|
||||
|
||||
const std::string& getToken() const
|
||||
{
|
||||
return token_;
|
||||
|
|
|
@ -86,7 +86,7 @@ public:
|
|||
virtual bool isReply() const = 0;
|
||||
|
||||
virtual void validate() const {}
|
||||
|
||||
|
||||
virtual const std::string& getMessageType() const = 0;
|
||||
|
||||
virtual std::string toString() const = 0;
|
||||
|
|
|
@ -157,7 +157,7 @@ public:
|
|||
void setConnection(DHTConnection* connection);
|
||||
|
||||
void setMessageDispatcher(DHTMessageDispatcher* dispatcher);
|
||||
|
||||
|
||||
void setPeerAnnounceStorage(DHTPeerAnnounceStorage* storage);
|
||||
|
||||
void setTokenTracker(DHTTokenTracker* tokenTracker);
|
||||
|
|
|
@ -66,7 +66,7 @@ private:
|
|||
void onMessageReceived(const SharedHandle<DHTMessage>& message);
|
||||
public:
|
||||
DHTMessageReceiver(const SharedHandle<DHTMessageTracker>& tracker);
|
||||
|
||||
|
||||
~DHTMessageReceiver();
|
||||
|
||||
SharedHandle<DHTMessage> receiveMessage();
|
||||
|
|
|
@ -56,7 +56,7 @@ class DHTMessageTrackerEntry;
|
|||
class DHTMessageTracker {
|
||||
private:
|
||||
std::deque<SharedHandle<DHTMessageTrackerEntry> > entries_;
|
||||
|
||||
|
||||
SharedHandle<DHTRoutingTable> routingTable_;
|
||||
|
||||
SharedHandle<DHTMessageFactory> factory_;
|
||||
|
|
|
@ -56,7 +56,7 @@ private:
|
|||
std::string transactionID_;
|
||||
|
||||
std::string messageType_;
|
||||
|
||||
|
||||
SharedHandle<DHTMessageCallback> callback_;
|
||||
|
||||
Timer dispatchedTime_;
|
||||
|
@ -89,7 +89,7 @@ public:
|
|||
const SharedHandle<DHTMessageCallback>& getCallback() const
|
||||
{
|
||||
return callback_;
|
||||
}
|
||||
}
|
||||
|
||||
int64_t getElapsedMillis() const;
|
||||
};
|
||||
|
|
|
@ -61,14 +61,14 @@ private:
|
|||
Timer lastContact_;
|
||||
public:
|
||||
DHTNode();
|
||||
|
||||
|
||||
/**
|
||||
* id must be 20 bytes length
|
||||
*/
|
||||
DHTNode(const unsigned char* id);
|
||||
|
||||
~DHTNode();
|
||||
|
||||
|
||||
void generateID();
|
||||
|
||||
const unsigned char* getID() const
|
||||
|
|
|
@ -72,7 +72,7 @@ public:
|
|||
}
|
||||
|
||||
void removeStalePeerAddrEntry(time_t timeout);
|
||||
|
||||
|
||||
bool empty() const;
|
||||
|
||||
const Timer& getLastUpdated() const
|
||||
|
|
|
@ -92,7 +92,7 @@ DHTPeerAnnounceStorage::addPeerAnnounce(const unsigned char* infoHash,
|
|||
bool DHTPeerAnnounceStorage::contains(const unsigned char* infoHash) const
|
||||
{
|
||||
SharedHandle<DHTPeerAnnounceEntry> entry(new DHTPeerAnnounceEntry(infoHash));
|
||||
return
|
||||
return
|
||||
std::binary_search(entries_.begin(), entries_.end(), entry, InfoHashLess());
|
||||
}
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ DHTPeerLookupTask::getNodesFromMessage
|
|||
message->getClosestKNodes();
|
||||
nodes.insert(nodes.end(), knodes.begin(), knodes.end());
|
||||
}
|
||||
|
||||
|
||||
void DHTPeerLookupTask::onReceivedInternal
|
||||
(const DHTGetPeersReplyMessage* message)
|
||||
{
|
||||
|
@ -80,7 +80,7 @@ void DHTPeerLookupTask::onReceivedInternal
|
|||
A2_LOG_INFO(fmt("Received %lu peers.",
|
||||
static_cast<unsigned long>(message->getValues().size())));
|
||||
}
|
||||
|
||||
|
||||
SharedHandle<DHTMessage> DHTPeerLookupTask::createMessage
|
||||
(const SharedHandle<DHTNode>& remoteNode)
|
||||
{
|
||||
|
|
|
@ -60,9 +60,9 @@ public:
|
|||
virtual void getNodesFromMessage
|
||||
(std::vector<SharedHandle<DHTNode> >& nodes,
|
||||
const DHTGetPeersReplyMessage* message);
|
||||
|
||||
|
||||
virtual void onReceivedInternal(const DHTGetPeersReplyMessage* message);
|
||||
|
||||
|
||||
virtual SharedHandle<DHTMessage> createMessage
|
||||
(const SharedHandle<DHTNode>& remoteNode);
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ public:
|
|||
|
||||
void onReceived(const DHTPingReplyMessage* message);
|
||||
|
||||
void onTimeout(const SharedHandle<DHTNode>& node);
|
||||
void onTimeout(const SharedHandle<DHTNode>& node);
|
||||
|
||||
void setTimeout(time_t timeout)
|
||||
{
|
||||
|
|
|
@ -56,7 +56,7 @@ public:
|
|||
virtual void fillMessage(Dict* msgDict);
|
||||
|
||||
virtual SharedHandle<Dict> getArgument() = 0;
|
||||
|
||||
|
||||
virtual bool isReply() const;
|
||||
|
||||
virtual std::string toString() const;
|
||||
|
|
|
@ -64,7 +64,7 @@ public:
|
|||
|
||||
void onReceived(const DHTPingReplyMessage* message);
|
||||
|
||||
void onTimeout(const SharedHandle<DHTNode>& node);
|
||||
void onTimeout(const SharedHandle<DHTNode>& node);
|
||||
|
||||
void setTimeout(time_t timeout)
|
||||
{
|
||||
|
|
|
@ -58,7 +58,7 @@ public:
|
|||
virtual void fillMessage(Dict* msgDict);
|
||||
|
||||
virtual SharedHandle<Dict> getResponse() = 0;
|
||||
|
||||
|
||||
virtual bool isReply() const;
|
||||
|
||||
virtual std::string toString() const;
|
||||
|
|
|
@ -84,13 +84,13 @@ public:
|
|||
void moveBucketHead(const SharedHandle<DHTNode>& node);
|
||||
|
||||
void moveBucketTail(const SharedHandle<DHTNode>& node);
|
||||
|
||||
|
||||
SharedHandle<DHTBucket> getBucketFor(const unsigned char* nodeID) const;
|
||||
|
||||
SharedHandle<DHTBucket> getBucketFor(const SharedHandle<DHTNode>& node) const;
|
||||
|
||||
SharedHandle<DHTNode> getNode(const unsigned char* id, const std::string& ipaddr, uint16_t port) const;
|
||||
|
||||
|
||||
void getBuckets(std::vector<SharedHandle<DHTBucket> >& buckets) const;
|
||||
|
||||
void setTaskQueue(const SharedHandle<DHTTaskQueue>& taskQueue);
|
||||
|
|
|
@ -125,7 +125,7 @@ void DHTRoutingTableDeserializer::deserialize(const std::string& filename)
|
|||
filename.c_str(),
|
||||
"bad header"));
|
||||
}
|
||||
|
||||
|
||||
uint32_t temp32;
|
||||
uint64_t temp64;
|
||||
// time
|
||||
|
@ -138,7 +138,7 @@ void DHTRoutingTableDeserializer::deserialize(const std::string& filename)
|
|||
READ_CHECK(fp, &temp64, sizeof(temp64));
|
||||
serializedTime_.setTimeInSec(ntoh64(temp64));
|
||||
}
|
||||
|
||||
|
||||
// localnode
|
||||
// 8bytes reserved
|
||||
readBytes(fp, buf, buf.size(), 8);
|
||||
|
|
|
@ -95,7 +95,7 @@ void DHTRoutingTableSerializer::serialize(const std::string& filename)
|
|||
// version
|
||||
header[6] = 0;
|
||||
header[7] = 0x03u;
|
||||
|
||||
|
||||
char zero[18];
|
||||
memset(zero, 0, sizeof(zero));
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ public:
|
|||
createPeerLookupTask(const SharedHandle<DownloadContext>& ctx,
|
||||
uint16_t tcpPort,
|
||||
const SharedHandle<PeerStorage>& peerStorage) = 0;
|
||||
|
||||
|
||||
virtual SharedHandle<DHTTask>
|
||||
createPeerAnnounceTask(const unsigned char* infoHash) = 0;
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ private:
|
|||
DHTMessageDispatcher* dispatcher_;
|
||||
|
||||
DHTMessageFactory* factory_;
|
||||
|
||||
|
||||
DHTTaskQueue* taskQueue_;
|
||||
|
||||
time_t timeout_;
|
||||
|
|
|
@ -88,7 +88,7 @@ private:
|
|||
if((*i).good_) {
|
||||
*out++ = (*i).addr_;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void markBad(const std::string& addr);
|
||||
|
@ -109,7 +109,7 @@ public:
|
|||
DNSCache& operator=(const DNSCache& c);
|
||||
|
||||
const std::string& find(const std::string& hostname, uint16_t port) const;
|
||||
|
||||
|
||||
template<typename OutputIterator>
|
||||
void findAll
|
||||
(OutputIterator out, const std::string& hostname, uint16_t port) const
|
||||
|
|
|
@ -132,7 +132,7 @@ SharedHandle<BtMessage> DefaultBtInteractive::receiveHandshake(bool quickReply)
|
|||
}
|
||||
|
||||
peer_->setPeerId(message->getPeerId());
|
||||
|
||||
|
||||
if(message->isFastExtensionSupported()) {
|
||||
peer_->setFastExtensionEnabled(true);
|
||||
A2_LOG_INFO(fmt(MSG_FAST_EXTENSION_ENABLED, cuid_));
|
||||
|
@ -367,7 +367,7 @@ void DefaultBtInteractive::fillPiece(size_t maxMissingBlock) {
|
|||
btRequestFactory_->getTargetPieceIndexes(excludedIndexes);
|
||||
pieceStorage_->getMissingPiece
|
||||
(pieces, diffMissingBlock, peer_, excludedIndexes, cuid_);
|
||||
} else {
|
||||
} else {
|
||||
pieces.reserve(diffMissingBlock);
|
||||
pieceStorage_->getMissingPiece(pieces, diffMissingBlock, peer_, cuid_);
|
||||
}
|
||||
|
@ -568,7 +568,7 @@ size_t DefaultBtInteractive::countPendingMessage()
|
|||
{
|
||||
return dispatcher_->countMessageInQueue();
|
||||
}
|
||||
|
||||
|
||||
bool DefaultBtInteractive::isSendingMessageInProgress()
|
||||
{
|
||||
return dispatcher_->isSendingInProgress();
|
||||
|
|
|
@ -68,7 +68,7 @@ private:
|
|||
int keepAliveCount;
|
||||
public:
|
||||
FloodingStat():chokeUnchokeCount(0), keepAliveCount(0) {}
|
||||
|
||||
|
||||
void incChokeUnchokeCount() {
|
||||
if(chokeUnchokeCount < INT_MAX) {
|
||||
chokeUnchokeCount++;
|
||||
|
@ -184,7 +184,7 @@ public:
|
|||
size_t receiveMessages();
|
||||
|
||||
virtual size_t countPendingMessage();
|
||||
|
||||
|
||||
virtual bool isSendingMessageInProgress();
|
||||
|
||||
virtual size_t countReceivedMessageInIteration() const;
|
||||
|
|
|
@ -201,7 +201,7 @@ public:
|
|||
peer_(peer),
|
||||
pieceStorage_(pieceStorage)
|
||||
{}
|
||||
|
||||
|
||||
void operator()(const RequestSlot& slot) const
|
||||
{
|
||||
if(!peer_->isInPeerAllowedIndexSet(slot.getIndex())) {
|
||||
|
@ -225,7 +225,7 @@ private:
|
|||
public:
|
||||
FindChokedRequestSlot(const SharedHandle<Peer>& peer):
|
||||
peer_(peer) {}
|
||||
|
||||
|
||||
bool operator()(const RequestSlot& slot) const
|
||||
{
|
||||
return !peer_->isInPeerAllowedIndexSet(slot.getIndex());
|
||||
|
|
|
@ -206,7 +206,7 @@ void DefaultBtProgressInfoFile::save()
|
|||
// It is assumed that integers are saved as:
|
||||
// 1) host byte order if version == 0000
|
||||
// 2) network byte order if version == 0001
|
||||
void DefaultBtProgressInfoFile::load()
|
||||
void DefaultBtProgressInfoFile::load()
|
||||
{
|
||||
A2_LOG_INFO(fmt(MSG_LOADING_SEGMENT_FILE, filename_.c_str()));
|
||||
BufferedFile fp(filename_.c_str(), BufferedFile::READ);
|
||||
|
@ -356,7 +356,7 @@ void DefaultBtProgressInfoFile::load()
|
|||
piece->setHashType(dctx_->getPieceHashType());
|
||||
|
||||
#endif // ENABLE_MESSAGE_DIGEST
|
||||
|
||||
|
||||
inFlightPieces.push_back(piece);
|
||||
}
|
||||
pieceStorage_->addInFlightPiece(inFlightPieces);
|
||||
|
|
|
@ -114,7 +114,7 @@ public:
|
|||
virtual void executeChoke();
|
||||
|
||||
void deleteUnusedPeer(size_t delSize);
|
||||
|
||||
|
||||
void onErasingPeer(const SharedHandle<Peer>& peer);
|
||||
|
||||
void onReturningPeer(const SharedHandle<Peer>& peer);
|
||||
|
|
|
@ -122,7 +122,7 @@ public:
|
|||
// priority.
|
||||
DefaultPieceStorage(const SharedHandle<DownloadContext>& downloadContext,
|
||||
const Option* option);
|
||||
|
||||
|
||||
virtual ~DefaultPieceStorage();
|
||||
|
||||
#ifdef ENABLE_BITTORRENT
|
||||
|
@ -206,7 +206,7 @@ public:
|
|||
virtual void initStorage();
|
||||
|
||||
virtual void setupFileFilter();
|
||||
|
||||
|
||||
virtual void clearFileFilter();
|
||||
|
||||
virtual bool downloadFinished();
|
||||
|
@ -215,7 +215,7 @@ public:
|
|||
|
||||
virtual void setBitfield(const unsigned char* bitfield,
|
||||
size_t bitfieldLength);
|
||||
|
||||
|
||||
virtual size_t getBitfieldLength();
|
||||
|
||||
virtual const unsigned char* getBitfield();
|
||||
|
@ -234,7 +234,7 @@ public:
|
|||
{
|
||||
return endGame_;
|
||||
}
|
||||
|
||||
|
||||
virtual void enterEndGame()
|
||||
{
|
||||
endGame_ = true;
|
||||
|
@ -270,7 +270,7 @@ public:
|
|||
|
||||
virtual void addPieceStats(const unsigned char* bitfield,
|
||||
size_t bitfieldLength);
|
||||
|
||||
|
||||
virtual void subtractPieceStats(const unsigned char* bitfield,
|
||||
size_t bitfieldLength);
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ private:
|
|||
bool knowsTotalLength_;
|
||||
|
||||
RequestGroup* ownerRequestGroup_;
|
||||
|
||||
|
||||
std::vector<SharedHandle<ContextAttribute> > attrs_;
|
||||
|
||||
Timer downloadStartTime_;
|
||||
|
@ -99,7 +99,7 @@ public:
|
|||
~DownloadContext();
|
||||
|
||||
const std::string& getPieceHash(size_t index) const;
|
||||
|
||||
|
||||
const std::vector<std::string>& getPieceHashes() const
|
||||
{
|
||||
return pieceHashes_;
|
||||
|
@ -219,7 +219,7 @@ public:
|
|||
}
|
||||
|
||||
int64_t calculateSessionTime() const;
|
||||
|
||||
|
||||
// Returns FileEntry at given offset. SharedHandle<FileEntry>() is
|
||||
// returned if no such FileEntry is found.
|
||||
SharedHandle<FileEntry> findFileEntryByOffset(int64_t offset) const;
|
||||
|
|
|
@ -115,7 +115,7 @@ private:
|
|||
|
||||
// key = IP address:port, value = SocketPoolEntry
|
||||
std::multimap<std::string, SocketPoolEntry> socketPool_;
|
||||
|
||||
|
||||
Timer lastSocketPoolScan_;
|
||||
|
||||
bool noWait_;
|
||||
|
@ -151,7 +151,7 @@ private:
|
|||
void onEndOfRun();
|
||||
|
||||
void afterEachIteration();
|
||||
|
||||
|
||||
void poolSocket(const std::string& key, const SocketPoolEntry& entry);
|
||||
|
||||
std::multimap<std::string, SocketPoolEntry>::iterator
|
||||
|
@ -162,7 +162,7 @@ private:
|
|||
SharedHandle<FileAllocationMan> fileAllocationMan_;
|
||||
SharedHandle<CheckIntegrityMan> checkIntegrityMan_;
|
||||
Option* option_;
|
||||
public:
|
||||
public:
|
||||
DownloadEngine(const SharedHandle<EventPoll>& eventPoll);
|
||||
|
||||
~DownloadEngine();
|
||||
|
|
|
@ -159,7 +159,7 @@ int translateEvents(EventPoll::EventType events)
|
|||
newEvents |= EPOLLERR;
|
||||
}
|
||||
if(EventPoll::EVENT_HUP&events) {
|
||||
newEvents |= EPOLLHUP;
|
||||
newEvents |= EPOLLHUP;
|
||||
}
|
||||
return newEvents;
|
||||
}
|
||||
|
|
24
src/Event.h
24
src/Event.h
|
@ -78,7 +78,7 @@ public:
|
|||
{
|
||||
return command_;
|
||||
}
|
||||
|
||||
|
||||
void addEvents(int events)
|
||||
{
|
||||
events_ |= events;
|
||||
|
@ -86,14 +86,14 @@ public:
|
|||
|
||||
void removeEvents(int events)
|
||||
{
|
||||
events_ &= (~events);
|
||||
events_ &= (~events);
|
||||
}
|
||||
|
||||
bool eventsEmpty() const
|
||||
{
|
||||
return events_ == 0;
|
||||
}
|
||||
|
||||
|
||||
bool operator==(const CommandEvent& commandEvent) const
|
||||
{
|
||||
return command_ == commandEvent.command_;
|
||||
|
@ -134,7 +134,7 @@ public:
|
|||
socketEntry->removeCommandEvent(*this);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#ifdef ENABLE_ASYNC_DNS
|
||||
|
||||
template<typename SocketEntry, typename EventPoll>
|
||||
|
@ -153,7 +153,7 @@ public:
|
|||
{
|
||||
return *resolver_ == *event.resolver_;
|
||||
}
|
||||
|
||||
|
||||
virtual int getEvents() const
|
||||
{
|
||||
return events_;
|
||||
|
@ -198,11 +198,11 @@ template<typename CommandEvent, typename ADNSEvent>
|
|||
class SocketEntry {
|
||||
protected:
|
||||
sock_t socket_;
|
||||
|
||||
|
||||
std::deque<CommandEvent> commandEvents_;
|
||||
|
||||
|
||||
#ifdef ENABLE_ASYNC_DNS
|
||||
|
||||
|
||||
std::deque<ADNSEvent> adnsEvents_;
|
||||
|
||||
#endif // ENABLE_ASYNC_DNS
|
||||
|
@ -247,7 +247,7 @@ public:
|
|||
}
|
||||
|
||||
#ifdef ENABLE_ASYNC_DNS
|
||||
|
||||
|
||||
void addADNSEvent(const ADNSEvent& aev)
|
||||
{
|
||||
typename std::deque<ADNSEvent>::iterator i =
|
||||
|
@ -287,7 +287,7 @@ public:
|
|||
return commandEvents_.empty();
|
||||
#endif // !ENABLE_ASYNC_DNS)
|
||||
}
|
||||
|
||||
|
||||
void processEvents(int events)
|
||||
{
|
||||
std::for_each(commandEvents_.begin(), commandEvents_.end(),
|
||||
|
@ -313,7 +313,7 @@ private:
|
|||
Command* command_;
|
||||
|
||||
size_t socketsSize_;
|
||||
|
||||
|
||||
sock_t sockets_[ARES_GETSOCK_MAXNUM];
|
||||
|
||||
public:
|
||||
|
@ -358,7 +358,7 @@ public:
|
|||
}
|
||||
socketsSize_ = i;
|
||||
}
|
||||
|
||||
|
||||
void removeSocketEvents(EventPoll* e)
|
||||
{
|
||||
for(size_t i = 0; i < socketsSize_; ++i) {
|
||||
|
|
|
@ -47,7 +47,7 @@ namespace aria2 {
|
|||
class Exception:public std::exception {
|
||||
private:
|
||||
const char* file_;
|
||||
|
||||
|
||||
int line_;
|
||||
// This is low-level system error code, typically errno in Linux.
|
||||
int errNum_;
|
||||
|
|
|
@ -45,7 +45,7 @@ SharedHandle<Exception> FatalException::copy() const
|
|||
FatalException::FatalException
|
||||
(const char* file, int line, const std::string& msg):
|
||||
Exception(file, line, msg) {}
|
||||
|
||||
|
||||
FatalException::FatalException
|
||||
(const char* file, int line, const std::string& msg,
|
||||
const Exception& cause):
|
||||
|
|
|
@ -77,7 +77,7 @@ std::string FeedbackURISelector::select
|
|||
if(uri.empty()) {
|
||||
A2_LOG_DEBUG("No URI returned from selectFaster()");
|
||||
uri = selectRarer(fileEntry->getRemainingUris(), usedHosts);
|
||||
}
|
||||
}
|
||||
if(!uri.empty()) {
|
||||
std::deque<std::string>& uris = fileEntry->getRemainingUris();
|
||||
uris.erase(std::find(uris.begin(), uris.end(), uri));
|
||||
|
|
|
@ -50,7 +50,7 @@ namespace aria2 {
|
|||
class File {
|
||||
private:
|
||||
std::string name_;
|
||||
|
||||
|
||||
/**
|
||||
* Returns the return value of stat(...)
|
||||
*/
|
||||
|
|
|
@ -73,7 +73,7 @@ bool FileAllocationCommand::executeInternal()
|
|||
static_cast<long int>(timer_.difference(global::wallclock())),
|
||||
getRequestGroup()->getTotalLength()));
|
||||
getDownloadEngine()->getFileAllocationMan()->dropPickedEntry();
|
||||
|
||||
|
||||
std::vector<Command*>* commands = new std::vector<Command*>();
|
||||
auto_delete_container<std::vector<Command*> > commandsDel(commands);
|
||||
fileAllocationEntry_->prepareForNextAction(*commands, getDownloadEngine());
|
||||
|
|
|
@ -333,7 +333,7 @@ FtpConnection::findEndOfResponse
|
|||
|
||||
bool FtpConnection::bulkReceiveResponse(std::pair<int, std::string>& response)
|
||||
{
|
||||
char buf[1024];
|
||||
char buf[1024];
|
||||
while(1) {
|
||||
size_t size = sizeof(buf);
|
||||
socket_->readData(buf, size);
|
||||
|
|
|
@ -95,7 +95,7 @@ Command* FtpInitiateConnectionCommand::createNextCommand
|
|||
getCuid(), addr.c_str(), port));
|
||||
createSocket();
|
||||
getSocket()->establishConnection(addr, port);
|
||||
|
||||
|
||||
getRequest()->setConnectedAddrInfo(hostname, addr, port);
|
||||
if(proxyMethod == V_GET) {
|
||||
// Use GET for FTP via HTTP proxy.
|
||||
|
@ -104,7 +104,7 @@ Command* FtpInitiateConnectionCommand::createNextCommand
|
|||
(new SocketRecvBuffer(getSocket()));
|
||||
SharedHandle<HttpConnection> hc
|
||||
(new HttpConnection(getCuid(), getSocket(), socketRecvBuffer));
|
||||
|
||||
|
||||
HttpRequestCommand* c =
|
||||
new HttpRequestCommand(getCuid(), getRequest(), getFileEntry(),
|
||||
getRequestGroup(), hc, getDownloadEngine(),
|
||||
|
@ -138,7 +138,7 @@ Command* FtpInitiateConnectionCommand::createNextCommand
|
|||
(new SocketRecvBuffer(pooledSocket));
|
||||
SharedHandle<HttpConnection> hc
|
||||
(new HttpConnection(getCuid(), pooledSocket, socketRecvBuffer));
|
||||
|
||||
|
||||
HttpRequestCommand* c =
|
||||
new HttpRequestCommand(getCuid(), getRequest(), getFileEntry(),
|
||||
getRequestGroup(), hc, getDownloadEngine(),
|
||||
|
|
|
@ -273,7 +273,7 @@ bool FtpNegotiationCommand::recvPwd()
|
|||
|
||||
bool FtpNegotiationCommand::sendCwdPrep()
|
||||
{
|
||||
// Calling setReadCheckSocket() is needed when the socket is reused,
|
||||
// Calling setReadCheckSocket() is needed when the socket is reused,
|
||||
setReadCheckSocket(getSocket());
|
||||
cwdDirs_.push_front(ftp_->getBaseWorkingDir());
|
||||
util::split(getRequest()->getDir().begin(), getRequest()->getDir().end(),
|
||||
|
@ -354,7 +354,7 @@ bool FtpNegotiationCommand::recvMdtm()
|
|||
getCuid()));
|
||||
}
|
||||
sequence_ = SEQ_SEND_SIZE;
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FtpNegotiationCommand::sendSize() {
|
||||
|
@ -702,7 +702,7 @@ bool FtpNegotiationCommand::resolveProxy()
|
|||
A2_LOG_INFO(fmt(MSG_CONNECTING_TO_SERVER,
|
||||
getCuid(),
|
||||
proxyAddr_.c_str(), proxyReq->getPort()));
|
||||
dataSocket_.reset(new SocketCore());
|
||||
dataSocket_.reset(new SocketCore());
|
||||
dataSocket_->establishConnection(proxyAddr_, proxyReq->getPort());
|
||||
disableReadCheckSocket();
|
||||
setWriteCheckSocket(dataSocket_);
|
||||
|
@ -742,7 +742,7 @@ bool FtpNegotiationCommand::sendTunnelRequest()
|
|||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
SharedHandle<HttpRequest> httpRequest(new HttpRequest());
|
||||
httpRequest->setUserAgent(getOption()->get(PREF_USER_AGENT));
|
||||
SharedHandle<Request> req(new Request());
|
||||
|
|
|
@ -72,7 +72,7 @@ public:
|
|||
{
|
||||
return bytesProcessed_;
|
||||
}
|
||||
|
||||
|
||||
static const std::string NAME;
|
||||
};
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ public:
|
|||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
virtual int64_t getPositionToWrite() const
|
||||
{
|
||||
return writtenLength_;
|
||||
|
|
|
@ -195,13 +195,13 @@ std::string HttpRequest::createRequest()
|
|||
if(!request_->isKeepAliveEnabled() && !request_->isPipeliningEnabled()) {
|
||||
builtinHds.push_back(std::make_pair("Connection:", "close"));
|
||||
}
|
||||
if(segment_ && segment_->getLength() > 0 &&
|
||||
if(segment_ && segment_->getLength() > 0 &&
|
||||
(request_->isPipeliningEnabled() || getStartByte() > 0)) {
|
||||
std::string rangeHeader(fmt("bytes=%" PRId64 "-", getStartByte()));
|
||||
if(request_->isPipeliningEnabled()) {
|
||||
rangeHeader += util::itos(getEndByte());
|
||||
} else if(getProtocol() != "ftp" && endOffsetOverride_ > 0) {
|
||||
// FTP via http proxy does not support endbytes
|
||||
// FTP via http proxy does not support endbytes
|
||||
rangeHeader += util::itos(endOffsetOverride_-1);
|
||||
}
|
||||
builtinHds.push_back(std::make_pair("Range:", rangeHeader));
|
||||
|
@ -386,7 +386,7 @@ const std::string& HttpRequest::getCurrentURI() const
|
|||
{
|
||||
return request_->getCurrentUri();
|
||||
}
|
||||
|
||||
|
||||
const std::string& HttpRequest::getDir() const
|
||||
{
|
||||
return request_->getDir();
|
||||
|
|
|
@ -56,7 +56,7 @@ class AuthConfig;
|
|||
|
||||
class HttpRequest {
|
||||
private:
|
||||
|
||||
|
||||
static const std::string USER_AGENT;
|
||||
|
||||
SharedHandle<Request> request_;
|
||||
|
@ -117,7 +117,7 @@ public:
|
|||
const std::string& getProtocol() const;
|
||||
|
||||
const std::string& getCurrentURI() const;
|
||||
|
||||
|
||||
const std::string& getDir() const;
|
||||
|
||||
const std::string& getFile() const;
|
||||
|
@ -165,7 +165,7 @@ public:
|
|||
void disableContentEncoding();
|
||||
|
||||
void setUserAgent(const std::string& userAgent);
|
||||
|
||||
|
||||
// accepts multiline headers, delimited by LF
|
||||
void addHeader(const std::string& headers);
|
||||
|
||||
|
@ -193,7 +193,7 @@ public:
|
|||
* object.
|
||||
*/
|
||||
void setProxyRequest(const SharedHandle<Request>& proxyRequest);
|
||||
|
||||
|
||||
/*
|
||||
* Returns true if non-Null proxy request is set by setProxyRequest().
|
||||
* Otherwise, returns false.
|
||||
|
|
|
@ -60,7 +60,7 @@ private:
|
|||
SharedHandle<HttpHeader> httpHeader_;
|
||||
public:
|
||||
HttpResponse();
|
||||
|
||||
|
||||
~HttpResponse();
|
||||
|
||||
void validateResponse() const;
|
||||
|
|
|
@ -558,7 +558,7 @@ HttpDownloadCommand* HttpResponseCommand::createHttpDownloadCommand
|
|||
command->installStreamFilter(filter);
|
||||
if(getRequestGroup()->isFileAllocationEnabled() &&
|
||||
!decideFileAllocation(filter)) {
|
||||
getRequestGroup()->setFileAllocationEnabled(false);
|
||||
getRequestGroup()->setFileAllocationEnabled(false);
|
||||
}
|
||||
getRequestGroup()->getURISelector()->tuneDownloadCommand
|
||||
(getFileEntry()->getRemainingUris(), command);
|
||||
|
|
|
@ -52,6 +52,6 @@ public:
|
|||
virtual ~HttpServerResponseCommand();
|
||||
};
|
||||
|
||||
} // namespace aria2
|
||||
} // namespace aria2
|
||||
|
||||
#endif // D_HTTP_SERVER_RESPONSE_COMMAND_H
|
||||
|
|
|
@ -105,7 +105,7 @@ bool HttpSkipResponseCommand::executeInternal()
|
|||
// If request method is HEAD or content-length header is present and
|
||||
// it's value is 0, then pool socket for reuse.
|
||||
// If content-length header is not present, then EOF is expected in the end.
|
||||
// In this case, the content is thrown away and socket cannot be pooled.
|
||||
// In this case, the content is thrown away and socket cannot be pooled.
|
||||
if(getRequest()->getMethod() == Request::METHOD_HEAD ||
|
||||
httpResponse_->getHttpHeader()->defined(HttpHeader::CONTENT_LENGTH)) {
|
||||
poolConnection();
|
||||
|
|
|
@ -84,7 +84,7 @@ InitiatorMSEHandshakeCommand::~InitiatorMSEHandshakeCommand()
|
|||
{
|
||||
requestGroup_->decreaseNumCommand();
|
||||
btRuntime_->decreaseConnections();
|
||||
|
||||
|
||||
delete mseHandshake_;
|
||||
}
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ public:
|
|||
|
||||
static bool supports(const std::string& hashType);
|
||||
static size_t getDigestLength(const std::string& hashType);
|
||||
|
||||
|
||||
size_t getDigestLength() const;
|
||||
void reset();
|
||||
void update(const void* data, size_t length);
|
||||
|
|
|
@ -63,7 +63,7 @@ public:
|
|||
|
||||
static bool supports(const std::string& hashType);
|
||||
static size_t getDigestLength(const std::string& hashType);
|
||||
|
||||
|
||||
size_t getDigestLength() const;
|
||||
void reset();
|
||||
void update(const void* data, size_t length);
|
||||
|
|
|
@ -190,7 +190,7 @@ void MSEHandshake::initCipher(const unsigned char* infoHash)
|
|||
memcpy(s, initiator_?"keyA":"keyB", 4);
|
||||
memcpy(s+4, secret_, KEY_LENGTH);
|
||||
memcpy(s+4+KEY_LENGTH, infoHash, INFO_HASH_LENGTH);
|
||||
|
||||
|
||||
unsigned char localCipherKey[20];
|
||||
sha1_->reset();
|
||||
message_digest::digest(localCipherKey, sizeof(localCipherKey),
|
||||
|
@ -252,7 +252,7 @@ void MSEHandshake::createReq23Hash(unsigned char* md, const unsigned char* infoH
|
|||
unsigned char yh[20];
|
||||
sha1_->reset();
|
||||
message_digest::digest(yh, sizeof(yh), sha1_, y, sizeof(y));
|
||||
|
||||
|
||||
for(size_t i = 0; i < 20; ++i) {
|
||||
md[i] = xh[i]^yh[i];
|
||||
}
|
||||
|
|
|
@ -126,7 +126,7 @@ public:
|
|||
const Option* op);
|
||||
|
||||
~MSEHandshake();
|
||||
|
||||
|
||||
HANDSHAKE_TYPE identifyHandshakeType();
|
||||
|
||||
void initEncryptionFacility(bool initiator);
|
||||
|
|
|
@ -68,7 +68,7 @@ public:
|
|||
{
|
||||
return id_;
|
||||
}
|
||||
|
||||
|
||||
static int64_t genId();
|
||||
};
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ public:
|
|||
void reorderResourcesByPriority();
|
||||
|
||||
void reorderMetaurlsByPriority();
|
||||
|
||||
|
||||
bool containsLanguage(const std::string& lang) const;
|
||||
|
||||
bool containsOS(const std::string& os) const;
|
||||
|
|
|
@ -368,7 +368,7 @@ void MetalinkParserController::addHashOfChunkChecksumV4(const std::string& md)
|
|||
} else {
|
||||
cancelChunkChecksumTransactionV4();
|
||||
}
|
||||
#endif // ENABLE_MESSAGE_DIGEST
|
||||
#endif // ENABLE_MESSAGE_DIGEST
|
||||
}
|
||||
|
||||
void MetalinkParserController::commitChunkChecksumTransactionV4()
|
||||
|
|
|
@ -56,7 +56,7 @@ public:
|
|||
const char* prefix,
|
||||
const char* nsUri,
|
||||
const std::vector<XmlAttr>& attrs) {}
|
||||
|
||||
|
||||
virtual void endElement
|
||||
(MetalinkParserStateMachine* stm,
|
||||
const char* localname,
|
||||
|
|
|
@ -519,7 +519,7 @@ void MetalinkParserStateMachine::beginElement
|
|||
{
|
||||
stateStack_.top()->beginElement(this, localname, prefix, nsUri, attrs);
|
||||
}
|
||||
|
||||
|
||||
void MetalinkParserStateMachine::endElement
|
||||
(const char* localname,
|
||||
const char* prefix,
|
||||
|
|
|
@ -60,7 +60,7 @@ private:
|
|||
|
||||
static MetalinkParserState* initialState_;
|
||||
static MetalinkParserState* skipTagState_;
|
||||
|
||||
|
||||
// Metalink3
|
||||
static MetalinkParserState* metalinkState_;
|
||||
static MetalinkParserState* filesState_; // Metalink3Spec
|
||||
|
@ -126,7 +126,7 @@ public:
|
|||
void setVersionState();
|
||||
|
||||
void setLanguageState();
|
||||
|
||||
|
||||
void setOSState();
|
||||
|
||||
void setVerificationState(); // Metalink3Spec
|
||||
|
|
|
@ -133,7 +133,7 @@ SharedHandle<DiskWriterEntry> createDiskWriterEntry
|
|||
SharedHandle<DiskWriterEntry> entry(new DiskWriterEntry(fileEntry));
|
||||
entry->needsFileAllocation(needsFileAllocation);
|
||||
return entry;
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
||||
void MultiDiskAdaptor::resetDiskWriterEntries()
|
||||
|
@ -243,11 +243,11 @@ void MultiDiskAdaptor::openIfNot
|
|||
if(!entry->isOpen()) {
|
||||
// A2_LOG_DEBUG(fmt("DiskWriterEntry: Cache MISS. offset=%s",
|
||||
// util::itos(entry->getFileEntry()->getOffset()).c_str()));
|
||||
|
||||
|
||||
int numOpened = openedDiskWriterEntries_.size();
|
||||
(entry.get()->*open)();
|
||||
if(numOpened >= maxOpenFiles_) {
|
||||
// Cache is full.
|
||||
// Cache is full.
|
||||
// Choose one DiskWriterEntry randomly and close it.
|
||||
size_t index =
|
||||
SimpleRandomizer::getInstance()->getRandomNumber(numOpened);
|
||||
|
@ -258,7 +258,7 @@ void MultiDiskAdaptor::openIfNot
|
|||
(*i) = entry;
|
||||
} else {
|
||||
openedDiskWriterEntries_.push_back(entry);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// A2_LOG_DEBUG(fmt("DiskWriterEntry: Cache HIT. offset=%s",
|
||||
// util::itos(entry->getFileEntry()->getOffset()).c_str()));
|
||||
|
@ -360,7 +360,7 @@ void throwOnDiskWriterNotOpened(const SharedHandle<DiskWriterEntry>& e,
|
|||
throw DL_ABORT_EX
|
||||
(fmt("DiskWriter for offset=%" PRId64 ", filename=%s is not opened.",
|
||||
static_cast<int64_t>(offset),
|
||||
e->getFilePath().c_str()));
|
||||
e->getFilePath().c_str()));
|
||||
}
|
||||
} // namespace
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ public:
|
|||
virtual ~MultiFileAllocationIterator();
|
||||
|
||||
virtual void allocateChunk();
|
||||
|
||||
|
||||
virtual bool finished();
|
||||
|
||||
virtual int64_t getCurrentLength();
|
||||
|
|
|
@ -205,7 +205,7 @@ void Netrc::parse(const std::string& path)
|
|||
skipMacdef(fp);
|
||||
}
|
||||
state = GET_TOKEN;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(state != GET_TOKEN) {
|
||||
|
|
|
@ -66,7 +66,7 @@ public:
|
|||
int64_t getAsLLInt(const Pref* pref) const;
|
||||
bool getAsBool(const Pref* pref) const;
|
||||
double getAsDouble(const Pref* pref) const;
|
||||
|
||||
|
||||
void remove(const Pref* pref);
|
||||
|
||||
void clear();
|
||||
|
|
|
@ -152,7 +152,7 @@ void Peer::peerInterested(bool b)
|
|||
assert(res_);
|
||||
res_->peerInterested(b);
|
||||
}
|
||||
|
||||
|
||||
// this peer should be choked
|
||||
bool Peer::chokingRequired() const
|
||||
{
|
||||
|
|
|
@ -98,7 +98,7 @@ public:
|
|||
{
|
||||
return id_ == p.id_;
|
||||
}
|
||||
|
||||
|
||||
bool operator!=(const Peer& p)
|
||||
{
|
||||
return !(*this == p);
|
||||
|
@ -201,7 +201,7 @@ public:
|
|||
bool peerInterested() const;
|
||||
|
||||
void peerInterested(bool b);
|
||||
|
||||
|
||||
// this peer should be choked
|
||||
bool chokingRequired() const;
|
||||
|
||||
|
@ -240,7 +240,7 @@ public:
|
|||
* Returns the number of bytes downloaded from the remote host.
|
||||
*/
|
||||
int64_t getSessionDownloadLength() const;
|
||||
|
||||
|
||||
void setBitfield(const unsigned char* bitfield, size_t bitfieldLength);
|
||||
|
||||
const unsigned char* getBitfield() const;
|
||||
|
@ -254,7 +254,7 @@ public:
|
|||
* operation = 0: set index-th bit to 0
|
||||
*/
|
||||
void updateBitfield(size_t index, int operation);
|
||||
|
||||
|
||||
void setFastExtensionEnabled(bool enabled);
|
||||
|
||||
bool isFastExtensionEnabled() const;
|
||||
|
|
|
@ -133,7 +133,7 @@ void PeerAbstractCommand::disableReadCheckSocket()
|
|||
e_->deleteSocketForReadCheck(readCheckTarget_, this);
|
||||
checkSocketIsReadable_ = false;
|
||||
readCheckTarget_.reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PeerAbstractCommand::setReadCheckSocket(const SharedHandle<SocketCore>& socket)
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue