2010-03-30 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>

Added --bt-tracker-connect-timeout and --bt-tracker-timeout
	option.
	* doc/aria2c.1.txt
	* src/OptionHandlerFactory.cc
	* src/TrackerWatcherCommand.cc
	* src/prefs.cc
	* src/prefs.h
	* src/usage_text.h
pull/1/head
Tatsuhiro Tsujikawa 2010-03-30 14:17:16 +00:00
parent 2c20f588c8
commit 68156ef258
9 changed files with 96 additions and 4 deletions

View File

@ -1,3 +1,14 @@
2010-03-30 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Added --bt-tracker-connect-timeout and --bt-tracker-timeout
option.
* doc/aria2c.1.txt
* src/OptionHandlerFactory.cc
* src/TrackerWatcherCommand.cc
* src/prefs.cc
* src/prefs.h
* src/usage_text.h
2010-03-30 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Documented that specifying --seed-time=0 disables seeding after

View File

@ -695,6 +695,14 @@ is given, this feature is disabled\&. Default:
\fI0\fR
.RE
.PP
\fB\-\-bt\-tracker\-connect\-timeout\fR=SEC
.RS 4
Set the connect timeout in seconds to establish connection to tracker\&. After the connection is established, this option makes no effect and
\fB\-\-bt\-tracker\-timeout\fR
option is used instead\&. Default:
\fI60\fR
.RE
.PP
\fB\-\-bt\-tracker\-interval\fR=SEC
.RS 4
Set the interval in seconds between tracker requests\&. This completely overrides interval value and aria2 just uses this value and ignores the min interval and interval value in the response of tracker\&. If
@ -703,6 +711,12 @@ is set, aria2 determines interval based on the response of tracker and the downl
\fI0\fR
.RE
.PP
\fB\-\-bt\-tracker\-timeout\fR=SEC
.RS 4
Set timeout in seconds\&. Default:
\fI60\fR
.RE
.PP
\fB\-\-dht\-entry\-point\fR=HOST:PORT
.RS 4
Set host and port as an entry point to DHT network\&.

View File

@ -1433,6 +1433,17 @@ writes the piece to the appropriate files.</td>
</p>
</dd>
<dt class="hdlist1">
<strong>--bt-tracker-connect-timeout</strong>=SEC
</dt>
<dd>
<p>
Set the connect timeout in seconds to establish connection to
tracker. After the connection is established, this option makes no
effect and <strong>--bt-tracker-timeout</strong> option is used instead. Default:
<em>60</em>
</p>
</dd>
<dt class="hdlist1">
<strong>--bt-tracker-interval</strong>=SEC
</dt>
<dd>
@ -1445,6 +1456,14 @@ writes the piece to the appropriate files.</td>
</p>
</dd>
<dt class="hdlist1">
<strong>--bt-tracker-timeout</strong>=SEC
</dt>
<dd>
<p>
Set timeout in seconds. Default: <em>60</em>
</p>
</dd>
<dt class="hdlist1">
<strong>--dht-entry-point</strong>=HOST:PORT
</dt>
<dd>
@ -4057,7 +4076,7 @@ files in the program, then also delete it here.</p></div>
<div id="footnotes"><hr /></div>
<div id="footer">
<div id="footer-text">
Last updated 2010-03-30 21:50:17 JST
Last updated 2010-03-30 23:12:40 JST
</div>
</div>
</body>

View File

@ -492,6 +492,13 @@ BitTorrent Specific Options
Stop BitTorrent download if download speed is 0 in consecutive SEC
seconds. If '0' is given, this feature is disabled. Default: '0'
*--bt-tracker-connect-timeout*=SEC::
Set the connect timeout in seconds to establish connection to
tracker. After the connection is established, this option makes no
effect and *--bt-tracker-timeout* option is used instead. Default:
'60'
*--bt-tracker-interval*=SEC::
Set the interval in seconds between tracker requests. This
completely overrides interval value and aria2 just uses this value
@ -499,6 +506,10 @@ BitTorrent Specific Options
tracker. If '0' is set, aria2 determines interval based on the
response of tracker and the download progress. Default: '0'
*--bt-tracker-timeout*=SEC::
Set timeout in seconds. Default: '60'
*--dht-entry-point*=HOST:PORT::
Set host and port as an entry point to DHT network.

View File

@ -1198,6 +1198,15 @@ OptionHandlers OptionHandlerFactory::createOptionHandlers()
op->hide();
handlers.push_back(op);
}
{
SharedHandle<NumberOptionHandler> op(new NumberOptionHandler
(PREF_BT_TRACKER_CONNECT_TIMEOUT,
TEXT_BT_TRACKER_CONNECT_TIMEOUT,
"60",
1, 600));
op->addTag(TAG_BITTORRENT);
handlers.push_back(op);
}
{
SharedHandle<NumberOptionHandler> op(new NumberOptionHandler
(PREF_BT_TRACKER_INTERVAL,
@ -1207,6 +1216,15 @@ OptionHandlers OptionHandlerFactory::createOptionHandlers()
op->addTag(TAG_BITTORRENT);
handlers.push_back(op);
}
{
SharedHandle<NumberOptionHandler> op(new NumberOptionHandler
(PREF_BT_TRACKER_TIMEOUT,
TEXT_BT_TRACKER_TIMEOUT,
"60",
1, 600));
op->addTag(TAG_BITTORRENT);
handlers.push_back(op);
}
{
SharedHandle<OptionHandler> op(new HostPortOptionHandler
(PREF_DHT_ENTRY_POINT,

View File

@ -217,8 +217,6 @@ TrackerWatcherCommand::createRequestGroup(const std::string& uri)
std::vector<std::string> uris;
uris.push_back(uri);
SharedHandle<RequestGroup> rg(new RequestGroup(getOption()));
// If backup tracker is available, only try 2 times for each tracker
// and if they all fails, then try next one.
if(backupTrackerIsAvailable(_requestGroup->getDownloadContext())) {
if(logger->debug()) {
logger->debug("This is multi-tracker announce.");
@ -228,11 +226,16 @@ TrackerWatcherCommand::createRequestGroup(const std::string& uri)
logger->debug("This is single-tracker announce.");
}
}
// If backup tracker is available, try 2 times for each tracker
// and if they all fails, then try next one.
rg->getOption()->put(PREF_MAX_TRIES, "2");
// TODO When dry-run mode becomes available in BitTorrent, set
// PREF_DRY_RUN=false too.
rg->getOption()->put(PREF_USE_HEAD, V_FALSE);
// Setting tracker timeouts
rg->setTimeout(rg->getOption()->getAsInt(PREF_BT_TRACKER_TIMEOUT));
rg->getOption()->put(PREF_CONNECT_TIMEOUT,
rg->getOption()->get(PREF_BT_TRACKER_CONNECT_TIMEOUT));
static const std::string TRACKER_ANNOUNCE_FILE("[tracker.announce]");
SharedHandle<DownloadContext> dctx
(new DownloadContext(getOption()->getAsInt(PREF_SEGMENT_SIZE),

View File

@ -334,6 +334,10 @@ const std::string PREF_BT_METADATA_ONLY("bt-metadata-only");
const std::string PREF_BT_ENABLE_LPD("bt-enable-lpd");
// values: string
const std::string PREF_BT_LPD_INTERFACE("bt-lpd-interface");
// values: 1*digit
const std::string PREF_BT_TRACKER_TIMEOUT("bt-tracker-timeout");
// values: 1*digit
const std::string PREF_BT_TRACKER_CONNECT_TIMEOUT("bt-tracker-connect-timeout");
/**
* Metalink related preferences

View File

@ -338,6 +338,10 @@ extern const std::string PREF_BT_METADATA_ONLY;
extern const std::string PREF_BT_ENABLE_LPD;
// values: string
extern const std::string PREF_BT_LPD_INTERFACE;
// values: 1*digit
extern const std::string PREF_BT_TRACKER_TIMEOUT;
// values: 1*digit
extern const std::string PREF_BT_TRACKER_CONNECT_TIMEOUT;
/**
* Metalink related preferences

View File

@ -657,3 +657,11 @@
" is 0, aria2 downloads file from scratch when all\n" \
" given URIs do not support resume.\n" \
" See --always-resume option.")
#define TEXT_BT_TRACKER_TIMEOUT \
_(" --bt-tracker-timeout=SEC Set timeout in seconds.")
#define TEXT_BT_TRACKER_CONNECT_TIMEOUT \
_(" --bt-tracker-connect-timeout=SEC Set the connect timeout in seconds to\n" \
" establish connection to tracker. After the\n" \
" connection is established, this option makes no\n" \
" effect and --bt-tracker-timeout option is used\n" \
" instead.")