mirror of https://github.com/aria2/aria2
Get peers from DHT more frequently when the size of peer list is 0.
parent
2666bc8170
commit
8eb1de9ef8
|
@ -75,12 +75,13 @@ bool DHTGetPeersCommand::execute()
|
||||||
if(btRuntime_->isHalt()) {
|
if(btRuntime_->isHalt()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
time_t elapsed = lastGetPeerTime_.difference(global::wallclock);
|
||||||
if(!task_ &&
|
if(!task_ &&
|
||||||
((numRetry_ > 0 &&
|
((numRetry_ > 0 && elapsed >= static_cast<time_t>(numRetry_*5)) ||
|
||||||
lastGetPeerTime_.difference(global::wallclock) >= (time_t)numRetry_*5) ||
|
elapsed >= GET_PEER_INTERVAL ||
|
||||||
lastGetPeerTime_.difference(global::wallclock) >= GET_PEER_INTERVAL ||
|
(((btRuntime_->lessThanMinPeers() && elapsed >= GET_PEER_INTERVAL_LOW) ||
|
||||||
(btRuntime_->lessThanMinPeers() &&
|
(btRuntime_->getConnections() == 0 &&
|
||||||
lastGetPeerTime_.difference(global::wallclock) >= GET_PEER_MIN_INTERVAL
|
elapsed >= GET_PEER_INTERVAL_ZERO))
|
||||||
&& !requestGroup_->downloadFinished()))) {
|
&& !requestGroup_->downloadFinished()))) {
|
||||||
A2_LOG_DEBUG(fmt("Issuing PeerLookup for infoHash=%s",
|
A2_LOG_DEBUG(fmt("Issuing PeerLookup for infoHash=%s",
|
||||||
bittorrent::getInfoHashString
|
bittorrent::getInfoHashString
|
||||||
|
|
|
@ -54,7 +54,9 @@ class DHTGetPeersCommand:public Command {
|
||||||
private:
|
private:
|
||||||
static const time_t GET_PEER_INTERVAL = (15*60);
|
static const time_t GET_PEER_INTERVAL = (15*60);
|
||||||
|
|
||||||
static const time_t GET_PEER_MIN_INTERVAL = (5*60);
|
static const time_t GET_PEER_INTERVAL_LOW = (5*60);
|
||||||
|
|
||||||
|
static const time_t GET_PEER_INTERVAL_ZERO = 60;
|
||||||
|
|
||||||
static const size_t MAX_RETRIES = 10;
|
static const size_t MAX_RETRIES = 10;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue