mirror of https://github.com/aria2/aria2
2008-09-02 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Contact tracker frequently when the number of connections are 0 and download is not finished yet. * src/ActivePeerConnectionCommand.cc * src/BtAnnounce.h * src/DefaultBtAnnounce.cc * src/DefaultBtAnnounce.h * test/MockBtAnnounce.hpull/1/head
parent
c46b6055c6
commit
574ca31e38
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
||||||
|
2008-09-02 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
||||||
|
|
||||||
|
Contact tracker frequently when the number of connections are 0 and
|
||||||
|
download is not finished yet.
|
||||||
|
* src/ActivePeerConnectionCommand.cc
|
||||||
|
* src/BtAnnounce.h
|
||||||
|
* src/DefaultBtAnnounce.cc
|
||||||
|
* src/DefaultBtAnnounce.h
|
||||||
|
* test/MockBtAnnounce.h
|
||||||
|
|
||||||
2008-09-02 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
2008-09-02 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
||||||
|
|
||||||
Moved threthold values to UTPexExtensionMessage.
|
Moved threthold values to UTPexExtensionMessage.
|
||||||
|
|
|
@ -47,6 +47,7 @@
|
||||||
#include "Option.h"
|
#include "Option.h"
|
||||||
#include "BtConstants.h"
|
#include "BtConstants.h"
|
||||||
#include "SocketCore.h"
|
#include "SocketCore.h"
|
||||||
|
#include "BtAnnounce.h"
|
||||||
|
|
||||||
namespace aria2 {
|
namespace aria2 {
|
||||||
|
|
||||||
|
@ -96,6 +97,10 @@ bool ActivePeerConnectionCommand::execute() {
|
||||||
PeerHandle peer = peerStorage->getUnusedPeer();
|
PeerHandle peer = peerStorage->getUnusedPeer();
|
||||||
connectToPeer(peer);
|
connectToPeer(peer);
|
||||||
}
|
}
|
||||||
|
if(btRuntime->getConnections() == 0 &&
|
||||||
|
!pieceStorage->downloadFinished()) {
|
||||||
|
btAnnounce->overrideMinInterval(BtAnnounce::DEFAULT_ANNOUNCE_INTERVAL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
e->commands.push_back(this);
|
e->commands.push_back(this);
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "SharedHandle.h"
|
#include "SharedHandle.h"
|
||||||
|
#include "a2time.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace aria2 {
|
namespace aria2 {
|
||||||
|
@ -104,6 +105,8 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual void shuffleAnnounce() = 0;
|
virtual void shuffleAnnounce() = 0;
|
||||||
|
|
||||||
|
virtual void overrideMinInterval(time_t interval) = 0;
|
||||||
|
|
||||||
static const std::string FAILURE_REASON;
|
static const std::string FAILURE_REASON;
|
||||||
|
|
||||||
static const std::string WARNING_MESSAGE;
|
static const std::string WARNING_MESSAGE;
|
||||||
|
@ -119,6 +122,8 @@ public:
|
||||||
static const std::string INCOMPLETE;
|
static const std::string INCOMPLETE;
|
||||||
|
|
||||||
static const std::string PEERS;
|
static const std::string PEERS;
|
||||||
|
|
||||||
|
static const unsigned int DEFAULT_ANNOUNCE_INTERVAL = 120;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef SharedHandle<BtAnnounce> BtAnnounceHandle;
|
typedef SharedHandle<BtAnnounce> BtAnnounceHandle;
|
||||||
|
|
|
@ -316,4 +316,9 @@ PeerStorageHandle DefaultBtAnnounce::getPeerStorage() const
|
||||||
return peerStorage;
|
return peerStorage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DefaultBtAnnounce::overrideMinInterval(time_t interval)
|
||||||
|
{
|
||||||
|
minInterval = interval;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace aria2
|
} // namespace aria2
|
||||||
|
|
|
@ -67,9 +67,6 @@ private:
|
||||||
SharedHandle<BtRuntime> btRuntime;
|
SharedHandle<BtRuntime> btRuntime;
|
||||||
SharedHandle<PieceStorage> pieceStorage;
|
SharedHandle<PieceStorage> pieceStorage;
|
||||||
SharedHandle<PeerStorage> peerStorage;
|
SharedHandle<PeerStorage> peerStorage;
|
||||||
|
|
||||||
static const unsigned int DEFAULT_ANNOUNCE_INTERVAL = 120;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DefaultBtAnnounce(const SharedHandle<BtContext>& btContext,
|
DefaultBtAnnounce(const SharedHandle<BtContext>& btContext,
|
||||||
const Option* option);
|
const Option* option);
|
||||||
|
@ -115,6 +112,8 @@ public:
|
||||||
|
|
||||||
virtual void shuffleAnnounce();
|
virtual void shuffleAnnounce();
|
||||||
|
|
||||||
|
virtual void overrideMinInterval(time_t interval);
|
||||||
|
|
||||||
void generateKey();
|
void generateKey();
|
||||||
|
|
||||||
void setRandomizer(const SharedHandle<Randomizer>& randomizer);
|
void setRandomizer(const SharedHandle<Randomizer>& randomizer);
|
||||||
|
|
|
@ -56,6 +56,8 @@ public:
|
||||||
return peerId;
|
return peerId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual void overrideMinInterval(time_t interval) {}
|
||||||
|
|
||||||
void setPeerId(const std::string& peerId) {
|
void setPeerId(const std::string& peerId) {
|
||||||
this->peerId = peerId;
|
this->peerId = peerId;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue