rebuilt html

This commit is contained in:
Arvid Norberg 2009-11-11 07:03:50 +00:00
parent 158dd71ac2
commit 74f235cd2e
4 changed files with 113 additions and 57 deletions

View File

@ -328,18 +328,20 @@ sent to and received from UPnP devices.</li>
</ul>
</td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">openssl</span></tt></td>
<tr><td><tt class="docutils literal"><span class="pre">encryption</span></tt></td>
<td><ul class="first last simple">
<li><tt class="docutils literal"><span class="pre">pe</span></tt> - turns on support for encrypted
connections. requires openssl (libcrypto)</li>
<li><tt class="docutils literal"><span class="pre">sha-1</span></tt> - openssl will be used instead of the
public domain SHA-1 implementation shipped with
libtorrent. <tt class="docutils literal"><span class="pre">libcrypto.a</span></tt> will be required for
linking. Encryption support is still turned off.</li>
<li><tt class="docutils literal"><span class="pre">openssl</span></tt> - links against openssl and
libcrypto to enable https and encrypted
bittorrent connections.</li>
<li><tt class="docutils literal"><span class="pre">gcrypt</span></tt> - links against libgcrypt to enable
encrypted bittorrent connections.</li>
<li><tt class="docutils literal"><span class="pre">tommath</span></tt> - uses a shipped version of
libtommath and a custom rc4 implementation
(based on libtomcrypt). This is the default
option.</li>
<li><tt class="docutils literal"><span class="pre">off</span></tt> - turns off support for encrypted
connections. openssl is not linked in. The
shipped public domain SHA-1 implementation is
used.</li>
connections. The shipped public domain SHA-1
implementation is used.</li>
</ul>
</td>
</tr>
@ -639,16 +641,6 @@ UTF-8 strings in pathnames are converted into
UTF-16 before they are passed to the file
operations.</td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">LITTLE_ENDIAN</span></tt></td>
<td>This will use the little endian version of the
sha-1 code. If defined on a big-endian system
the sha-1 hashes will be incorrect and fail.
If it is not defined and <tt class="docutils literal"><span class="pre">__BIG_ENDIAN__</span></tt>
isn't defined either (it is defined by Apple's
GCC) both little-endian and big-endian versions
will be built and the correct code will be
chosen at run-time.</td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">TORRENT_DISABLE_POOL_ALLOCATOR</span></tt></td>
<td>Disables use of <tt class="docutils literal"><span class="pre">boost::pool&lt;&gt;</span></tt>.</td>
</tr>
@ -681,10 +673,13 @@ protocol traffic.</td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">TORRENT_DISABLE_ENCRYPTION</span></tt></td>
<td>This will disable any encryption support and
the openssl dependency that comes with it.
the dependencies of a crypto library.
Encryption support is the peer connection
encrypted supported by clients such as
uTorrent, Azureus and KTorrent.</td>
uTorrent, Azureus and KTorrent.
If this is not defined, either
<tt class="docutils literal"><span class="pre">TORRENT_USE_OPENSSL</span></tt> or
<tt class="docutils literal"><span class="pre">TORRENT_USE_GCRYPT</span></tt> must be defined.</td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">_UNICODE</span></tt></td>
<td>On windows, this will cause the file IO

View File

@ -53,14 +53,15 @@
</li>
<li><a class="reference internal" href="#highlighted-features" id="id7">highlighted features</a><ul>
<li><a class="reference internal" href="#disk-caching" id="id8">disk caching</a></li>
<li><a class="reference internal" href="#network-buffers" id="id9">network buffers</a></li>
<li><a class="reference internal" href="#piece-picker" id="id10">piece picker</a></li>
<li><a class="reference internal" href="#merkle-hash-tree-torrents" id="id11">merkle hash tree torrents</a></li>
<li><a class="reference internal" href="#customizable-file-storage" id="id12">customizable file storage</a></li>
<li><a class="reference internal" href="#easy-to-use-api" id="id13">easy to use API</a></li>
<li><a class="reference internal" href="#high-performance-disk-subsystem" id="id9">high performance disk subsystem</a></li>
<li><a class="reference internal" href="#network-buffers" id="id10">network buffers</a></li>
<li><a class="reference internal" href="#piece-picker" id="id11">piece picker</a></li>
<li><a class="reference internal" href="#merkle-hash-tree-torrents" id="id12">merkle hash tree torrents</a></li>
<li><a class="reference internal" href="#customizable-file-storage" id="id13">customizable file storage</a></li>
<li><a class="reference internal" href="#easy-to-use-api" id="id14">easy to use API</a></li>
</ul>
</li>
<li><a class="reference internal" href="#portability" id="id14">portability</a></li>
<li><a class="reference internal" href="#portability" id="id15">portability</a></li>
</ul>
</div>
<div class="section" id="introduction">
@ -133,9 +134,6 @@ download speed is high enough from that particular peer.</li>
<li>supports gzipped tracker-responses</li>
<li>can limit the upload and download bandwidth usage and the maximum number of
unchoked peers</li>
<li>implements fair trade. User settable trade-ratio, must at least be 1:1,
but one can choose to trade 1 for 2 or any other ratio that isn't unfair
to the other party.</li>
<li>possibility to limit the number of connections.</li>
<li>delays have messages if there's no other outgoing traffic to the peer, and
doesn't send have messages to peers that already has the piece. This saves
@ -143,8 +141,12 @@ bandwidth.</li>
<li>selective downloading. The ability to select which parts of a torrent you
want to download.</li>
<li>ip filter to disallow ip addresses and ip ranges from connecting and
being connected</li>
being connected.</li>
<li>NAT-PMP and UPnP support (automatic port mapping on routers that supports it)</li>
<li>implements automatic upload slots, to optimize download rate without spreading
upload capacity too thin. The number of upload slots is adjusted based on the
peers' download capacity to work even for connections that are orders of
magnitude faster than others.</li>
</ul>
</div>
</div>
@ -194,6 +196,25 @@ better with piece sizes.</p>
algorithm. It clearly shows an increased utilization, which means higher read hit rates
or smaller caches with maintained hit rate.</p>
</div>
<div class="section" id="high-performance-disk-subsystem">
<h2>high performance disk subsystem</h2>
<p>In some circumstances, the disk cache may not suffice to provide maximum performance.
One such example is high performance seeding, to a large number of peers, over a fast
up-link. In such a case, the amount of RAM may simply not be enough to cache disk
reads. When there's not enough RAM to cache disk reads, the disk throughput would
typically degrade to perform as poorly as with no cache at all, with the majority
of the time spent waiting for the disk head to seek.</p>
<p>To solve this problem, libtorrent sorts read requests by their physical offset on the
disk. They are processed by having the disk read head sweep back and forth over the drive.</p>
<p>This makes libtorrent very suitable for large scale, high-throughput seeding.</p>
<img alt="disk_access_no_elevator.png" src="disk_access_no_elevator.png" style="width: 49%;" />
<img alt="disk_access_elevator.png" src="disk_access_elevator.png" style="width: 49%;" />
<p>These plots illustrates the physical disk offset for reads over time. The left plot
is of a run where disk operation re-ordering is turned off and the righ is when it's
turned on. The right one has a relatively smooth sine wave shape whereas the left
one is more random and involves much longer seeks back and forth over the disk.</p>
<p>True physical disk offset queries are only supported on newer linux kernels and Mac OS X.</p>
</div>
<div class="section" id="network-buffers">
<h2>network buffers</h2>
<p>On CPUs with small L2 caches, copying memory can be expensive operations. It is important

View File

@ -42,24 +42,25 @@
<div class="contents topic" id="table-of-contents">
<p class="topic-title first">Table of contents</p>
<ul class="simple">
<li><a class="reference internal" href="#overview" id="id2">overview</a></li>
<li><a class="reference internal" href="#high-level-example" id="id3">high level example</a></li>
<li><a class="reference internal" href="#add-files" id="id4">add_files</a></li>
<li><a class="reference internal" href="#set-piece-hashes" id="id5">set_piece_hashes()</a></li>
<li><a class="reference internal" href="#file-storage" id="id6">file_storage</a><ul>
<li><a class="reference internal" href="#add-file" id="id7">add_file()</a></li>
<li><a class="reference internal" href="#overview" id="id3">overview</a></li>
<li><a class="reference internal" href="#high-level-example" id="id4">high level example</a></li>
<li><a class="reference internal" href="#add-files" id="id5">add_files</a></li>
<li><a class="reference internal" href="#set-piece-hashes" id="id6">set_piece_hashes()</a></li>
<li><a class="reference internal" href="#file-storage" id="id7">file_storage</a><ul>
<li><a class="reference internal" href="#add-file" id="id8">add_file()</a></li>
<li><a class="reference internal" href="#id1" id="id9">add_file</a></li>
</ul>
</li>
<li><a class="reference internal" href="#create-torrent" id="id8">create_torrent</a><ul>
<li><a class="reference internal" href="#id1" id="id9">create_torrent()</a></li>
<li><a class="reference internal" href="#generate" id="id10">generate()</a></li>
<li><a class="reference internal" href="#set-comment" id="id11">set_comment()</a></li>
<li><a class="reference internal" href="#set-creator" id="id12">set_creator()</a></li>
<li><a class="reference internal" href="#set-hash" id="id13">set_hash()</a></li>
<li><a class="reference internal" href="#add-url-seed" id="id14">add_url_seed()</a></li>
<li><a class="reference internal" href="#add-node" id="id15">add_node()</a></li>
<li><a class="reference internal" href="#add-tracker" id="id16">add_tracker()</a></li>
<li><a class="reference internal" href="#set-priv-priv" id="id17">set_priv() priv()</a></li>
<li><a class="reference internal" href="#create-torrent" id="id10">create_torrent</a><ul>
<li><a class="reference internal" href="#id2" id="id11">create_torrent()</a></li>
<li><a class="reference internal" href="#generate" id="id12">generate()</a></li>
<li><a class="reference internal" href="#set-comment" id="id13">set_comment()</a></li>
<li><a class="reference internal" href="#set-creator" id="id14">set_creator()</a></li>
<li><a class="reference internal" href="#set-hash" id="id15">set_hash()</a></li>
<li><a class="reference internal" href="#add-url-seed" id="id16">add_url_seed()</a></li>
<li><a class="reference internal" href="#add-node" id="id17">add_node()</a></li>
<li><a class="reference internal" href="#add-tracker" id="id18">add_tracker()</a></li>
<li><a class="reference internal" href="#set-priv-priv" id="id19">set_priv() priv()</a></li>
</ul>
</li>
</ul>
@ -239,6 +240,23 @@ attribute_hidden
attribute_executable
</pre>
</div>
<div class="section" id="id1">
<h2>add_file</h2>
<blockquote>
<pre class="literal-block">
void add_file(file_entry const&amp; e);
void add_file(fs::path const&amp; p, size_type size);
</pre>
</blockquote>
<p>Adds a file to the file storage. If more files than one are added,
certain restrictions to their paths apply. In a multi-file file
storage (torrent), all files must share the same root directory.</p>
<p>That is, the first path element of all files must be the same.
This shared path element is also set to the name of the torrent. It
can be changed by calling <tt class="docutils literal"><span class="pre">set_name</span></tt>.</p>
<p>The built in functions to traverse a directory to add files will
make sure this requirement is fulfilled.</p>
</div>
</div>
<div class="section" id="create-torrent">
<h1>create_torrent</h1>
@ -268,7 +286,7 @@ struct create_torrent
bool priv() const;
};
</pre>
<div class="section" id="id1">
<div class="section" id="id2">
<h2>create_torrent()</h2>
<blockquote>
<pre class="literal-block">
@ -315,6 +333,23 @@ entry generate() const;
generate the flat file, use the bencode() function.</p>
<p>It may be useful to add custom entries to the torrent file before bencoding it
and saving it to disk.</p>
<p>If anything goes wrong during torrent generation, this function will return
an empty <tt class="docutils literal"><span class="pre">entry</span></tt> structure. You can test for this condition by querying the
type of the entry:</p>
<pre class="literal-block">
file_storage fs;
// add file ...
create_torrent t(fs);
// add trackers and piece hashes ...
e = t.generate();
if (e.type() == entry::undefined_t)
{
// something went wrong
}
</pre>
<p>For instance, you cannot generate a torrent with 0 files in it. If you don't add
any files to the <tt class="docutils literal"><span class="pre">file_storage</span></tt>, torrent generation will fail.</p>
</div>
<div class="section" id="set-comment">
<h2>set_comment()</h2>

View File

@ -930,7 +930,7 @@ struct session_status
int unchoke_counter;
int dht_nodes;
int dht_cache_nodes;
int dht_node_cache;
int dht_torrents;
int dht_global_nodes;
std::vector&lt;dht_lookup&gt; active_requests;
@ -970,11 +970,11 @@ be assigned a torrent yet.</p>
seconds until the next optimistic unchoke change and the start of the next
unchoke interval. These numbers may be reset prematurely if a peer that is
unchoked disconnects or becomes notinterested.</p>
<p><tt class="docutils literal"><span class="pre">dht_nodes</span></tt>, <tt class="docutils literal"><span class="pre">dht_cache_nodes</span></tt> and <tt class="docutils literal"><span class="pre">dht_torrents</span></tt> are only available when
<p><tt class="docutils literal"><span class="pre">dht_nodes</span></tt>, <tt class="docutils literal"><span class="pre">dht_node_cache</span></tt> and <tt class="docutils literal"><span class="pre">dht_torrents</span></tt> are only available when
built with DHT support. They are all set to 0 if the DHT isn't running. When
the DHT is running, <tt class="docutils literal"><span class="pre">dht_nodes</span></tt> is set to the number of nodes in the routing
table. This number only includes <em>active</em> nodes, not cache nodes. The
<tt class="docutils literal"><span class="pre">dht_cache_nodes</span></tt> is set to the number of nodes in the node cache. These nodes
<tt class="docutils literal"><span class="pre">dht_node_cache</span></tt> is set to the number of nodes in the node cache. These nodes
are used to replace the regular nodes in the routing table in case any of them
becomes unresponsive.</p>
<p><tt class="docutils literal"><span class="pre">dht_torrents</span></tt> are the number of torrents tracked by the DHT at the moment.</p>
@ -2716,14 +2716,14 @@ while (num_resume_data &gt; 0)
std::auto_ptr&lt;alert&gt; holder = ses.pop_alert();
if (dynamic_cast&lt;save_resume_data_failed_alert const*&gt;(a))
if (alert_cast&lt;save_resume_data_failed_alert&gt;(a))
{
process_alert(a);
--num_resume_data;
continue;
}
save_resume_data_alert const* rd = dynamic_cast&lt;save_resume_data_alert const*&gt;(a);
save_resume_data_alert const* rd = alert_cast&lt;save_resume_data_alert&gt;(a);
if (rd == 0)
{
process_alert(a);
@ -4566,9 +4566,14 @@ or upload rate.</td>
<p>Every alert belongs to one or more category. There is a small cost involved in posting alerts. Only
alerts that belong to an enabled category are posted. Setting the alert bitmask to 0 will disable
all alerts</p>
<p>When you get an alert, you can use <tt class="docutils literal"><span class="pre">typeid()</span></tt> or <tt class="docutils literal"><span class="pre">dynamic_cast&lt;&gt;</span></tt> to get more detailed
information on exactly which type it is. i.e. what kind of error it is. You can also use a
<a class="reference internal" href="#dispatcher">dispatcher</a> mechanism that's available in libtorrent.</p>
<p>When you get an alert, you can use <tt class="docutils literal"><span class="pre">alert_cast&lt;&gt;</span></tt> to attempt to cast the pointer to a
more specific alert type, to be queried for more information about the alert. <tt class="docutils literal"><span class="pre">alert_cast</span></tt>
has the followinf signature:</p>
<pre class="literal-block">
template &lt;T&gt; T* alert_cast(alert* a);
template &lt;T&gt; T const* alert_cast(alert const* a);
</pre>
<p>You can also use a <a class="reference internal" href="#dispatcher">dispatcher</a> mechanism that's available in libtorrent.</p>
<p>All alert types are defined in the <tt class="docutils literal"><span class="pre">&lt;libtorrent/alert_types.hpp&gt;</span></tt> header file.</p>
<p>The <tt class="docutils literal"><span class="pre">alert</span></tt> class is the base class that specific messages are derived from. This
is its synopsis:</p>