mirror of https://github.com/aria2/aria2
2009-03-20 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Added an option to specify the interval between tracker requests. If non-zero value is specified, aria2 uses it and ignores the interval value in the response of tracker. If zero is specified, aria2 determines the inteval value based on the tarcker response and download progress. * src/DefaultBtAnnounce.cc * src/DefaultBtAnnounce.h * src/OptionHandlerFactory.cc * src/RequestGroup.cc * src/prefs.cc * src/prefs.h * src/usage_text.hpull/1/head
parent
948b13ad52
commit
2170a850a8
15
ChangeLog
15
ChangeLog
|
@ -1,3 +1,18 @@
|
|||
2009-03-20 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||
|
||||
Added an option to specify the interval between tracker requests.
|
||||
If non-zero value is specified, aria2 uses it and ignores the
|
||||
interval value in the response of tracker. If zero is specified,
|
||||
aria2 determines the inteval value based on the tarcker response
|
||||
and download progress.
|
||||
* src/DefaultBtAnnounce.cc
|
||||
* src/DefaultBtAnnounce.h
|
||||
* src/OptionHandlerFactory.cc
|
||||
* src/RequestGroup.cc
|
||||
* src/prefs.cc
|
||||
* src/prefs.h
|
||||
* src/usage_text.h
|
||||
|
||||
2009-03-20 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||
|
||||
Added operator+=, operator-=, operator-
|
||||
|
|
|
@ -60,6 +60,7 @@ DefaultBtAnnounce::DefaultBtAnnounce(const BtContextHandle& btContext,
|
|||
trackers(0),
|
||||
interval(DEFAULT_ANNOUNCE_INTERVAL),
|
||||
minInterval(DEFAULT_ANNOUNCE_INTERVAL),
|
||||
_userDefinedInterval(0),
|
||||
complete(0),
|
||||
incomplete(0),
|
||||
announceList(btContext->getAnnounceTiers()),
|
||||
|
@ -80,7 +81,9 @@ void DefaultBtAnnounce::generateKey()
|
|||
}
|
||||
|
||||
bool DefaultBtAnnounce::isDefaultAnnounceReady() {
|
||||
return (trackers == 0 && prevAnnounceTime.elapsed(minInterval) &&
|
||||
return (trackers == 0 &&
|
||||
prevAnnounceTime.elapsed(_userDefinedInterval==0?
|
||||
minInterval:_userDefinedInterval) &&
|
||||
!announceList.allTiersFailed());
|
||||
}
|
||||
|
||||
|
|
|
@ -56,6 +56,7 @@ private:
|
|||
Time prevAnnounceTime;
|
||||
time_t interval;
|
||||
time_t minInterval;
|
||||
time_t _userDefinedInterval;
|
||||
unsigned int complete;
|
||||
unsigned int incomplete;
|
||||
AnnounceList announceList;
|
||||
|
@ -142,6 +143,11 @@ public:
|
|||
{
|
||||
return trackerId;
|
||||
}
|
||||
|
||||
void setUserDefinedInterval(time_t interval)
|
||||
{
|
||||
_userDefinedInterval = interval;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace aria2
|
||||
|
|
|
@ -930,6 +930,15 @@ OptionHandlers OptionHandlerFactory::createOptionHandlers()
|
|||
op->hide();
|
||||
handlers.push_back(op);
|
||||
}
|
||||
{
|
||||
SharedHandle<NumberOptionHandler> op(new NumberOptionHandler
|
||||
(PREF_BT_TRACKER_INTERVAL,
|
||||
TEXT_BT_TRACKER_INTERVAL,
|
||||
"0",
|
||||
0));
|
||||
op->addTag(TAG_BITTORRENT);
|
||||
handlers.push_back(op);
|
||||
}
|
||||
{
|
||||
SharedHandle<OptionHandler> op(new HostPortOptionHandler
|
||||
(PREF_DHT_ENTRY_POINT,
|
||||
|
|
|
@ -267,6 +267,8 @@ void RequestGroup::createInitialCommand(std::deque<Command*>& commands,
|
|||
btAnnounce->setBtRuntime(btRuntime);
|
||||
btAnnounce->setPieceStorage(_pieceStorage);
|
||||
btAnnounce->setPeerStorage(peerStorage);
|
||||
btAnnounce->setUserDefinedInterval
|
||||
(_option->getAsInt(PREF_BT_TRACKER_INTERVAL));
|
||||
btRegistry->registerBtAnnounce(btContext->getInfoHashAsString(),
|
||||
btAnnounce);
|
||||
btAnnounce->shuffleAnnounce();
|
||||
|
|
|
@ -289,6 +289,8 @@ const std::string PREF_BT_MAX_PEERS("bt-max-peers");
|
|||
const std::string PREF_BT_EXTERNAL_IP("bt-external-ip");
|
||||
// values: 1*digit '=' a string that your file system recognizes as a file name.
|
||||
const std::string PREF_INDEX_OUT("index-out");
|
||||
// values: 1*digit
|
||||
const std::string PREF_BT_TRACKER_INTERVAL("bt-tracker-interval");
|
||||
|
||||
/**
|
||||
* Metalink related preferences
|
||||
|
|
|
@ -293,6 +293,8 @@ extern const std::string PREF_BT_MAX_PEERS;
|
|||
extern const std::string PREF_BT_EXTERNAL_IP;
|
||||
// values: 1*digit '=' a string that your file system recognizes as a file name.
|
||||
extern const std::string PREF_INDEX_OUT;
|
||||
// values: 1*digit
|
||||
extern const std::string PREF_BT_TRACKER_INTERVAL;
|
||||
|
||||
/**
|
||||
* Metalink related preferences
|
||||
|
|
|
@ -505,3 +505,11 @@ _(" --dry-run[=true|false] If true is given, aria2 just checks whether the
|
|||
" data. This option has effect on HTTP/FTP download.\n"\
|
||||
" BitTorrent downloads are canceled if true is\n"\
|
||||
" specified.")
|
||||
#define TEXT_BT_TRACKER_INTERVAL \
|
||||
_(" --bt-tracker-interval=SEC Set the interval in seconds between tracker\n"\
|
||||
" requests. This completely overrides interval value\n"\
|
||||
" and aria2 just uses this value and ignores the\n"\
|
||||
" minInterval and interval value in the response of\n"\
|
||||
" tracker. If 0 is set, aria2 determines interval\n"\
|
||||
" based on the response of tracker and the download\n"\
|
||||
" progress.")
|
||||
|
|
Loading…
Reference in New Issue