* Allow hex values in the 'tos' option.

* Moved more encryption related code to HandshakeEncryption.


git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@797 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2006-10-25 08:24:20 +00:00
parent 2781ce9698
commit 5dfc986658
5 changed files with 29 additions and 11 deletions
+5 -2
View File
@@ -3,7 +3,7 @@
.\" <http://shell.ipoline.com/~elmert/comp/docbook2X/>
.\" Please send any bug reports, improvements, comments, patches,
.\" etc. to Steve Cheng <steve@ggi-project.org>.
.TH "RTORRENT" "1" "21 October 2006" "BitTorrent client for ncurses" ""
.TH "RTORRENT" "1" "25 October 2006" "BitTorrent client for ncurses" ""
.SH NAME
rtorrent \- a BitTorrent client for ncurses
@@ -425,9 +425,12 @@ Controls if a lock file is created in the session directory on startup.
Save the session files for all downloads.
.TP
\fBtos = \fIdefault|lowdelay|throughput|reliability|mincost\fB\fR
.TP
\fBtos = \fIhex\fB\fR
Change the TOS of peer connections, by default set to
\fBthroughput\fR\&. If the option is set to
\fBdefault\fR then the system default TOS is used.
\fBdefault\fR then the system default TOS is used. A
hex value may be used for non-standard settings.
.TP
\fBhandshake_log = \fIyes\fB\fR
Enable logging of the peer handshake. This generates a large number of
+3 -3
View File
@@ -897,12 +897,12 @@ Save the session files for all downloads.
<varlistentry>
<term>tos = <replaceable>default|lowdelay|throughput|reliability|mincost</replaceable></term>
<term>tos = <replaceable>hex</replaceable></term>
<listitem><para>
Change the TOS of peer connections, by default set to
<emphasis>throughput</emphasis>. If the option is set to
<emphasis>default</emphasis> then the system default TOS is used.
<emphasis>default</emphasis> then the system default TOS is used. A
hex value may be used for non-standard settings.
</para></listitem>
</varlistentry>
+9 -6
View File
@@ -279,25 +279,28 @@ apply_enable_trackers(Control* m, __UNUSED const std::string& arg) {
void
apply_tos(const std::string& arg) {
utils::Variable::value_type value;
torrent::ConnectionManager* cm = torrent::connection_manager();
if (arg == "default")
cm->set_priority(torrent::ConnectionManager::iptos_default);
value = torrent::ConnectionManager::iptos_default;
else if (arg == "lowdelay")
cm->set_priority(torrent::ConnectionManager::iptos_lowdelay);
value = torrent::ConnectionManager::iptos_lowdelay;
else if (arg == "throughput")
cm->set_priority(torrent::ConnectionManager::iptos_throughput);
value = torrent::ConnectionManager::iptos_throughput;
else if (arg == "reliability")
cm->set_priority(torrent::ConnectionManager::iptos_reliability);
value = torrent::ConnectionManager::iptos_reliability;
else if (arg == "mincost")
cm->set_priority(torrent::ConnectionManager::iptos_mincost);
value = torrent::ConnectionManager::iptos_mincost;
else
else if (!utils::Variable::string_to_value_unit_nothrow(arg.c_str(), &value, 16, 0))
throw torrent::input_error("Invalid TOS identifier.");
cm->set_priority(value);
}
void
+11
View File
@@ -94,4 +94,15 @@ Variable::string_to_value_unit(const char* pos, value_type* value, int base, int
return last;
}
bool
Variable::string_to_value_unit_nothrow(const char* pos, value_type* value, int base, int unit) {
try {
string_to_value_unit(pos, value, base, unit);
return true;
} catch (const torrent::input_error& e) {
return false;
}
}
}
+1
View File
@@ -56,6 +56,7 @@ public:
virtual void set(const torrent::Object& arg) = 0;
static const char* string_to_value_unit(const char* pos, value_type* value, int base, int unit);
static bool string_to_value_unit_nothrow(const char* pos, value_type* value, int base, int unit);
protected:
Variable(const Variable&);