*** empty log message ***
This commit is contained in:
parent
abbedbf104
commit
9983e7c85b
131
docs/manual.html
131
docs/manual.html
|
@ -40,29 +40,29 @@
|
||||||
<li><a class="reference" href="#tracker-alert" id="id29" name="id29">tracker_alert</a></li>
|
<li><a class="reference" href="#tracker-alert" id="id29" name="id29">tracker_alert</a></li>
|
||||||
<li><a class="reference" href="#hash-failed-alert" id="id30" name="id30">hash_failed_alert</a></li>
|
<li><a class="reference" href="#hash-failed-alert" id="id30" name="id30">hash_failed_alert</a></li>
|
||||||
<li><a class="reference" href="#peer-error-alert" id="id31" name="id31">peer_error_alert</a></li>
|
<li><a class="reference" href="#peer-error-alert" id="id31" name="id31">peer_error_alert</a></li>
|
||||||
<li><a class="reference" href="#chat-message-alert" id="id32" name="id32">chat_message_alert</a></li>
|
<li><a class="reference" href="#invalid-request-alert" id="id32" name="id32">invalid_request_alert</a></li>
|
||||||
<li><a class="reference" href="#dispatcher" id="id33" name="id33">dispatcher</a></li>
|
<li><a class="reference" href="#chat-message-alert" id="id33" name="id33">chat_message_alert</a></li>
|
||||||
|
<li><a class="reference" href="#dispatcher" id="id34" name="id34">dispatcher</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li><a class="reference" href="#exceptions" id="id34" name="id34">exceptions</a><ul>
|
<li><a class="reference" href="#exceptions" id="id35" name="id35">exceptions</a><ul>
|
||||||
<li><a class="reference" href="#invalid-handle" id="id35" name="id35">invalid_handle</a></li>
|
<li><a class="reference" href="#invalid-handle" id="id36" name="id36">invalid_handle</a></li>
|
||||||
<li><a class="reference" href="#duplicate-torrent" id="id36" name="id36">duplicate_torrent</a></li>
|
<li><a class="reference" href="#duplicate-torrent" id="id37" name="id37">duplicate_torrent</a></li>
|
||||||
<li><a class="reference" href="#invalid-encoding" id="id37" name="id37">invalid_encoding</a></li>
|
<li><a class="reference" href="#invalid-encoding" id="id38" name="id38">invalid_encoding</a></li>
|
||||||
<li><a class="reference" href="#type-error" id="id38" name="id38">type_error</a></li>
|
<li><a class="reference" href="#type-error" id="id39" name="id39">type_error</a></li>
|
||||||
<li><a class="reference" href="#invalid-torrent-file" id="id39" name="id39">invalid_torrent_file</a></li>
|
<li><a class="reference" href="#invalid-torrent-file" id="id40" name="id40">invalid_torrent_file</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li><a class="reference" href="#examples" id="id40" name="id40">examples</a><ul>
|
<li><a class="reference" href="#examples" id="id41" name="id41">examples</a><ul>
|
||||||
<li><a class="reference" href="#dump-torrent" id="id41" name="id41">dump_torrent</a></li>
|
<li><a class="reference" href="#dump-torrent" id="id42" name="id42">dump_torrent</a></li>
|
||||||
<li><a class="reference" href="#simple-client" id="id42" name="id42">simple client</a></li>
|
<li><a class="reference" href="#simple-client" id="id43" name="id43">simple client</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li><a class="reference" href="#fast-resume" id="id43" name="id43">fast resume</a></li>
|
<li><a class="reference" href="#fast-resume" id="id44" name="id44">fast resume</a><ul>
|
||||||
<li><a class="reference" href="#file-format" id="id44" name="id44">file format</a></li>
|
<li><a class="reference" href="#file-format" id="id45" name="id45">file format</a></li>
|
||||||
<li><a class="reference" href="#extensions" id="id45" name="id45">extensions</a><ul>
|
|
||||||
<li><a class="reference" href="#chat-messages" id="id46" name="id46">chat messages</a></li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
<li><a class="reference" href="#extensions" id="id46" name="id46">extensions</a></li>
|
||||||
<li><a class="reference" href="#aknowledgements" id="id47" name="id47">Aknowledgements</a></li>
|
<li><a class="reference" href="#aknowledgements" id="id47" name="id47">Aknowledgements</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
@ -100,7 +100,7 @@ party.</li>
|
||||||
<li>fast resume support, a way to get rid of the costly piece check at the start
|
<li>fast resume support, a way to get rid of the costly piece check at the start
|
||||||
of a resumed torrent. Saves the storage state, piece_picker state as well as all local
|
of a resumed torrent. Saves the storage state, piece_picker state as well as all local
|
||||||
peers in a separate fast-resume file.</li>
|
peers in a separate fast-resume file.</li>
|
||||||
<li>The extension protocol <a class="reference" href="http://nolar.com/azureus/extended.htm">described by Nolar</a>. See <a class="reference" href="#extensions">extensions</a>.</li>
|
<li>Supports the extension protocol <a class="reference" href="http://nolar.com/azureus/extended.htm">described by Nolar</a>. See <a class="reference" href="#extensions">extensions</a>.</li>
|
||||||
</ul>
|
</ul>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
<p>Functions that are yet to be implemented:</p>
|
<p>Functions that are yet to be implemented:</p>
|
||||||
|
@ -128,6 +128,7 @@ boost.filesystem, boost.date_time and various other boost libraries as well as z
|
||||||
<li>GCC 2.95</li>
|
<li>GCC 2.95</li>
|
||||||
</ul>
|
</ul>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
|
<p>libtorrent is released under the <a class="reference" href="http://www.opensource.org/licenses/bsd-license.php">BSD-license</a>.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="building">
|
<div class="section" id="building">
|
||||||
<h1><a class="toc-backref" href="#id10" name="building">building</a></h1>
|
<h1><a class="toc-backref" href="#id10" name="building">building</a></h1>
|
||||||
|
@ -1057,8 +1058,28 @@ struct peer_error_alert: alert
|
||||||
};
|
};
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="section" id="invalid-request-alert">
|
||||||
|
<h2><a class="toc-backref" href="#id32" name="invalid-request-alert">invalid_request_alert</a></h2>
|
||||||
|
<p>Thie is a debug alert that is generated by an incoming invalid piece request.</p>
|
||||||
|
<pre class="literal-block">
|
||||||
|
struct invalid_request_alert: alert
|
||||||
|
{
|
||||||
|
invalid_request_alert(
|
||||||
|
const peer_request& r
|
||||||
|
, const torrent_handle& h
|
||||||
|
, const peer_id& send
|
||||||
|
, const std::string& msg);
|
||||||
|
|
||||||
|
virtual std::auto_ptr<alert> clone() const;
|
||||||
|
|
||||||
|
torrent_handle handle;
|
||||||
|
peer_id sender;
|
||||||
|
peer_request request;
|
||||||
|
};
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
<div class="section" id="chat-message-alert">
|
<div class="section" id="chat-message-alert">
|
||||||
<h2><a class="toc-backref" href="#id32" name="chat-message-alert">chat_message_alert</a></h2>
|
<h2><a class="toc-backref" href="#id33" name="chat-message-alert">chat_message_alert</a></h2>
|
||||||
<p>This alert is generated when you receive a chat message from another peer. Chat messages
|
<p>This alert is generated when you receive a chat message from another peer. Chat messages
|
||||||
are supported as an extension ("chat"). It is generated as severity level <tt class="literal"><span class="pre">critical</span></tt>,
|
are supported as an extension ("chat"). It is generated as severity level <tt class="literal"><span class="pre">critical</span></tt>,
|
||||||
even though it doesn't necessarily require any user intervention, it's high priority
|
even though it doesn't necessarily require any user intervention, it's high priority
|
||||||
|
@ -1080,16 +1101,16 @@ struct chat_message_alert: alert
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="dispatcher">
|
<div class="section" id="dispatcher">
|
||||||
<h2><a class="toc-backref" href="#id33" name="dispatcher">dispatcher</a></h2>
|
<h2><a class="toc-backref" href="#id34" name="dispatcher">dispatcher</a></h2>
|
||||||
<p>TODO: describe the dispatcher mechanism</p>
|
<p>TODO: describe the dispatcher mechanism</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="exceptions">
|
<div class="section" id="exceptions">
|
||||||
<h1><a class="toc-backref" href="#id34" name="exceptions">exceptions</a></h1>
|
<h1><a class="toc-backref" href="#id35" name="exceptions">exceptions</a></h1>
|
||||||
<p>There are a number of exceptions that can be thrown from different places in libtorrent,
|
<p>There are a number of exceptions that can be thrown from different places in libtorrent,
|
||||||
here's a complete list with description.</p>
|
here's a complete list with description.</p>
|
||||||
<div class="section" id="invalid-handle">
|
<div class="section" id="invalid-handle">
|
||||||
<h2><a class="toc-backref" href="#id35" name="invalid-handle">invalid_handle</a></h2>
|
<h2><a class="toc-backref" href="#id36" name="invalid-handle">invalid_handle</a></h2>
|
||||||
<p>This exception is thrown when querying information from a <a class="reference" href="#torrent-handle">torrent_handle</a> that hasn't
|
<p>This exception is thrown when querying information from a <a class="reference" href="#torrent-handle">torrent_handle</a> that hasn't
|
||||||
been initialized or that has become invalid.</p>
|
been initialized or that has become invalid.</p>
|
||||||
<pre class="literal-block">
|
<pre class="literal-block">
|
||||||
|
@ -1100,7 +1121,7 @@ struct invalid_handle: std::exception
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="duplicate-torrent">
|
<div class="section" id="duplicate-torrent">
|
||||||
<h2><a class="toc-backref" href="#id36" name="duplicate-torrent">duplicate_torrent</a></h2>
|
<h2><a class="toc-backref" href="#id37" name="duplicate-torrent">duplicate_torrent</a></h2>
|
||||||
<p>This is thrown by <tt class="literal"><span class="pre">session::add_torrent()</span></tt> if the torrent already has been added to
|
<p>This is thrown by <tt class="literal"><span class="pre">session::add_torrent()</span></tt> if the torrent already has been added to
|
||||||
the session.</p>
|
the session.</p>
|
||||||
<pre class="literal-block">
|
<pre class="literal-block">
|
||||||
|
@ -1111,7 +1132,7 @@ struct duplicate_torrent: std::exception
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="invalid-encoding">
|
<div class="section" id="invalid-encoding">
|
||||||
<h2><a class="toc-backref" href="#id37" name="invalid-encoding">invalid_encoding</a></h2>
|
<h2><a class="toc-backref" href="#id38" name="invalid-encoding">invalid_encoding</a></h2>
|
||||||
<p>This is thrown by <tt class="literal"><span class="pre">bdecode()</span></tt> if the input data is not a valid bencoding.</p>
|
<p>This is thrown by <tt class="literal"><span class="pre">bdecode()</span></tt> if the input data is not a valid bencoding.</p>
|
||||||
<pre class="literal-block">
|
<pre class="literal-block">
|
||||||
struct invalid_encoding: std::exception
|
struct invalid_encoding: std::exception
|
||||||
|
@ -1121,7 +1142,7 @@ struct invalid_encoding: std::exception
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="type-error">
|
<div class="section" id="type-error">
|
||||||
<h2><a class="toc-backref" href="#id38" name="type-error">type_error</a></h2>
|
<h2><a class="toc-backref" href="#id39" name="type-error">type_error</a></h2>
|
||||||
<p>This is thrown from the accessors of <tt class="literal"><span class="pre">entry</span></tt> if the data type of the <tt class="literal"><span class="pre">entry</span></tt> doesn't
|
<p>This is thrown from the accessors of <tt class="literal"><span class="pre">entry</span></tt> if the data type of the <tt class="literal"><span class="pre">entry</span></tt> doesn't
|
||||||
match the type you want to extract from it.</p>
|
match the type you want to extract from it.</p>
|
||||||
<pre class="literal-block">
|
<pre class="literal-block">
|
||||||
|
@ -1132,7 +1153,7 @@ struct type_error: std::runtime_error
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="invalid-torrent-file">
|
<div class="section" id="invalid-torrent-file">
|
||||||
<h2><a class="toc-backref" href="#id39" name="invalid-torrent-file">invalid_torrent_file</a></h2>
|
<h2><a class="toc-backref" href="#id40" name="invalid-torrent-file">invalid_torrent_file</a></h2>
|
||||||
<p>This exception is thrown from the constructor of <tt class="literal"><span class="pre">torrent_info</span></tt> if the given bencoded information
|
<p>This exception is thrown from the constructor of <tt class="literal"><span class="pre">torrent_info</span></tt> if the given bencoded information
|
||||||
doesn't meet the requirements on what information has to be present in a torrent file.</p>
|
doesn't meet the requirements on what information has to be present in a torrent file.</p>
|
||||||
<pre class="literal-block">
|
<pre class="literal-block">
|
||||||
|
@ -1144,9 +1165,9 @@ struct invalid_torrent_file: std::exception
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="examples">
|
<div class="section" id="examples">
|
||||||
<h1><a class="toc-backref" href="#id40" name="examples">examples</a></h1>
|
<h1><a class="toc-backref" href="#id41" name="examples">examples</a></h1>
|
||||||
<div class="section" id="dump-torrent">
|
<div class="section" id="dump-torrent">
|
||||||
<h2><a class="toc-backref" href="#id41" name="dump-torrent">dump_torrent</a></h2>
|
<h2><a class="toc-backref" href="#id42" name="dump-torrent">dump_torrent</a></h2>
|
||||||
<p>This is an example of a program that will take a torrent-file as a parameter and
|
<p>This is an example of a program that will take a torrent-file as a parameter and
|
||||||
print information about it to std out:</p>
|
print information about it to std out:</p>
|
||||||
<pre class="literal-block">
|
<pre class="literal-block">
|
||||||
|
@ -1210,7 +1231,7 @@ int main(int argc, char* argv[])
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="simple-client">
|
<div class="section" id="simple-client">
|
||||||
<h2><a class="toc-backref" href="#id42" name="simple-client">simple client</a></h2>
|
<h2><a class="toc-backref" href="#id43" name="simple-client">simple client</a></h2>
|
||||||
<p>This is a simple client. It doesn't have much output to keep it simple:</p>
|
<p>This is a simple client. It doesn't have much output to keep it simple:</p>
|
||||||
<pre class="literal-block">
|
<pre class="literal-block">
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
@ -1262,7 +1283,7 @@ int main(int argc, char* argv[])
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="fast-resume">
|
<div class="section" id="fast-resume">
|
||||||
<h1><a class="toc-backref" href="#id43" name="fast-resume">fast resume</a></h1>
|
<h1><a class="toc-backref" href="#id44" name="fast-resume">fast resume</a></h1>
|
||||||
<p>The fast resume mechanism is a way to remember which pieces are downloaded and where they
|
<p>The fast resume mechanism is a way to remember which pieces are downloaded and where they
|
||||||
are put between sessions. You can generate fast resume data by calling
|
are put between sessions. You can generate fast resume data by calling
|
||||||
<tt class="literal"><span class="pre">torrent_handle::write_resume_data()</span></tt> on <a class="reference" href="#torrent-handle">torrent_handle</a>. You can then save this data
|
<tt class="literal"><span class="pre">torrent_handle::write_resume_data()</span></tt> on <a class="reference" href="#torrent-handle">torrent_handle</a>. You can then save this data
|
||||||
|
@ -1274,9 +1295,8 @@ so it will not have to start from scratch on the partially downloaded pieces.</p
|
||||||
will skip the time consuming checks. It may have to do the checking anyway, if the
|
will skip the time consuming checks. It may have to do the checking anyway, if the
|
||||||
fast-resume data is corrupt or doesn't fit the storage for that torrent, then it will
|
fast-resume data is corrupt or doesn't fit the storage for that torrent, then it will
|
||||||
not trust the fast-resume data and just do the checking.</p>
|
not trust the fast-resume data and just do the checking.</p>
|
||||||
</div>
|
|
||||||
<div class="section" id="file-format">
|
<div class="section" id="file-format">
|
||||||
<h1><a class="toc-backref" href="#id44" name="file-format">file format</a></h1>
|
<h2><a class="toc-backref" href="#id45" name="file-format">file format</a></h2>
|
||||||
<p>The file format is a bencoded dictionary containing the following fields:</p>
|
<p>The file format is a bencoded dictionary containing the following fields:</p>
|
||||||
<table border class="table">
|
<table border class="table">
|
||||||
<colgroup>
|
<colgroup>
|
||||||
|
@ -1297,7 +1317,7 @@ not trust the fast-resume data and just do the checking.</p>
|
||||||
<td>integer, the number of blocks per piece. Must be: piece_size
|
<td>integer, the number of blocks per piece. Must be: piece_size
|
||||||
/ (16 * 1024). Clamped to be within the range [1, 128]. It
|
/ (16 * 1024). Clamped to be within the range [1, 128]. It
|
||||||
is the number of blocks per (normal sized) piece. Usually
|
is the number of blocks per (normal sized) piece. Usually
|
||||||
each piece is 16 * 1024 bytes in size.</td>
|
each block is 16 * 1024 bytes in size.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr><td><tt class="literal"><span class="pre">slots</span></tt></td>
|
<tr><td><tt class="literal"><span class="pre">slots</span></tt></td>
|
||||||
<td><p class="first">list of integers. The list mappes slots ti piece indices. It
|
<td><p class="first">list of integers. The list mappes slots ti piece indices. It
|
||||||
|
@ -1355,39 +1375,32 @@ piece.</td>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<div class="section" id="extensions">
|
<div class="section" id="extensions">
|
||||||
<h1><a class="toc-backref" href="#id45" name="extensions">extensions</a></h1>
|
<h1><a class="toc-backref" href="#id46" name="extensions">extensions</a></h1>
|
||||||
<p>These extensions all operates within the <a class="reference" href="http://nolar.com/azureus/extended.html">extension protocol</a>. The
|
<p>These extensions all operates within the <a class="reference" href="http://nolar.com/azureus/extended.html">extension protocol</a>. The
|
||||||
name of the extension is the name used in the extension-list packets,
|
name of the extension is the name used in the extension-list packets,
|
||||||
and the payload is the data in the extended message (not counting the
|
and the payload is the data in the extended message (not counting the
|
||||||
length-prefix, message-id nor extension-id).</p>
|
length-prefix, message-id nor extension-id).</p>
|
||||||
<p>These are the extensions that are currently implemented.</p>
|
<p>The extension protocol is currently disabled, since it may not be compatible
|
||||||
<div class="section" id="chat-messages">
|
with future versions of bittorrent.</p>
|
||||||
<h2><a class="toc-backref" href="#id46" name="chat-messages">chat messages</a></h2>
|
<!-- These are the extensions that are currently implemented. -->
|
||||||
<p>Extension name: "chat"</p>
|
<!-- chat messages -->
|
||||||
<p>The payload in the packet is a bencoded dictionary with any
|
<!-- - - - - - - - - - - - - - -->
|
||||||
combination of the following entries:</p>
|
<!-- Extension name: "chat" -->
|
||||||
<table border class="table">
|
<!-- The payload in the packet is a bencoded dictionary with any -->
|
||||||
<colgroup>
|
<!-- combination of the following entries: -->
|
||||||
<col width="15%" />
|
<!-- +- - - - - - - - - -+- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -+
|
||||||
<col width="85%" />
|
| "msg" | This is a string that contains a message that |
|
||||||
</colgroup>
|
| | should be displayed to the user. |
|
||||||
<tbody valign="top">
|
+- - - - - - - - - -+- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -+
|
||||||
<tr><td>"msg"</td>
|
| "ctrl" | This is a control string that can tell a client that |
|
||||||
<td>This is a string that contains a message that
|
| | it is ignored (to make the user aware of that) and |
|
||||||
should be displayed to the user.</td>
|
| | it can also tell a client that it is no longer ignored.|
|
||||||
</tr>
|
| | These notifications are encoded as the strings: |
|
||||||
<tr><td>"ctrl"</td>
|
| | "ignored" and "not ignored". |
|
||||||
<td>This is a control string that can tell a client that
|
| | Any unrecognized strings should be ignored. |
|
||||||
it is ignored (to make the user aware of that) and
|
+- - - - - - - - - -+- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -+ -->
|
||||||
it can also tell a client that it is no longer ignored.
|
|
||||||
These notifications are encoded as the strings:
|
|
||||||
"ignored" and "not ignored".
|
|
||||||
Any unrecognized strings should be ignored.</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="aknowledgements">
|
<div class="section" id="aknowledgements">
|
||||||
<h1><a class="toc-backref" href="#id47" name="aknowledgements">Aknowledgements</a></h1>
|
<h1><a class="toc-backref" href="#id47" name="aknowledgements">Aknowledgements</a></h1>
|
||||||
|
|
|
@ -39,7 +39,7 @@ The current state includes the following features:
|
||||||
* fast resume support, a way to get rid of the costly piece check at the start
|
* fast resume support, a way to get rid of the costly piece check at the start
|
||||||
of a resumed torrent. Saves the storage state, piece_picker state as well as all local
|
of a resumed torrent. Saves the storage state, piece_picker state as well as all local
|
||||||
peers in a separate fast-resume file.
|
peers in a separate fast-resume file.
|
||||||
* The extension protocol `described by Nolar`__. See extensions_.
|
* Supports the extension protocol `described by Nolar`__. See extensions_.
|
||||||
|
|
||||||
__ http://home.elp.rr.com/tur/multitracker-spec.txt
|
__ http://home.elp.rr.com/tur/multitracker-spec.txt
|
||||||
.. _Azureus: http://azureus.sourceforge.net
|
.. _Azureus: http://azureus.sourceforge.net
|
||||||
|
@ -65,6 +65,10 @@ It does not compile on
|
||||||
|
|
||||||
* GCC 2.95
|
* GCC 2.95
|
||||||
|
|
||||||
|
libtorrent is released under the BSD-license_.
|
||||||
|
|
||||||
|
.. _BSD-license: http://www.opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
building
|
building
|
||||||
========
|
========
|
||||||
|
|
||||||
|
@ -74,7 +78,7 @@ Then you can use ``bjam`` to build libtorrent.
|
||||||
.. _boost: http://www.boost.org
|
.. _boost: http://www.boost.org
|
||||||
|
|
||||||
To make bjam work, you need to set the environment variable ``BOOST_ROOT`` to the
|
To make bjam work, you need to set the environment variable ``BOOST_ROOT`` to the
|
||||||
path where boost is installed (e.g. c:\boost_1_30_2 on windows). Then you can just run
|
path where boost is installed (e.g. c:\\boost_1_30_2 on windows). Then you can just run
|
||||||
``bjam`` in the libtorrent directory.
|
``bjam`` in the libtorrent directory.
|
||||||
|
|
||||||
The Jamfile doesn't work yet. On unix-systems you can use the makefile however. You
|
The Jamfile doesn't work yet. On unix-systems you can use the makefile however. You
|
||||||
|
@ -1373,21 +1377,25 @@ fast-resume data is corrupt or doesn't fit the storage for that torrent, then it
|
||||||
not trust the fast-resume data and just do the checking.
|
not trust the fast-resume data and just do the checking.
|
||||||
|
|
||||||
file format
|
file format
|
||||||
===========
|
-----------
|
||||||
|
|
||||||
The file format is a bencoded dictionary containing the following fields:
|
The file format is a bencoded dictionary containing the following fields:
|
||||||
|
|
||||||
+----------------------+--------------------------------------------------------------+
|
+----------------------+--------------------------------------------------------------+
|
||||||
| ``file-format`` | string: "libtorrent resume file" |
|
| ``file-format`` | string: "libtorrent resume file" |
|
||||||
|
| | |
|
||||||
+----------------------+--------------------------------------------------------------+
|
+----------------------+--------------------------------------------------------------+
|
||||||
| ``file-version`` | integer: 1 |
|
| ``file-version`` | integer: 1 |
|
||||||
|
| | |
|
||||||
+----------------------+--------------------------------------------------------------+
|
+----------------------+--------------------------------------------------------------+
|
||||||
| ``info-hash`` | string, the info hash of the torrent this data is saved for. |
|
| ``info-hash`` | string, the info hash of the torrent this data is saved for. |
|
||||||
|
| | |
|
||||||
+----------------------+--------------------------------------------------------------+
|
+----------------------+--------------------------------------------------------------+
|
||||||
| ``blocks per piece`` | integer, the number of blocks per piece. Must be: piece_size |
|
| ``blocks per piece`` | integer, the number of blocks per piece. Must be: piece_size |
|
||||||
| | / (16 * 1024). Clamped to be within the range [1, 128]. It |
|
| | / (16 * 1024). Clamped to be within the range [1, 128]. It |
|
||||||
| | is the number of blocks per (normal sized) piece. Usually |
|
| | is the number of blocks per (normal sized) piece. Usually |
|
||||||
| | each piece is 16 * 1024 bytes in size. |
|
| | each block is 16 * 1024 bytes in size. |
|
||||||
|
| | |
|
||||||
+----------------------+--------------------------------------------------------------+
|
+----------------------+--------------------------------------------------------------+
|
||||||
| ``slots`` | list of integers. The list mappes slots ti piece indices. It |
|
| ``slots`` | list of integers. The list mappes slots ti piece indices. It |
|
||||||
| | tells which piece is on which slot. If piece index is -2 it |
|
| | tells which piece is on which slot. If piece index is -2 it |
|
||||||
|
@ -1397,6 +1405,7 @@ The file format is a bencoded dictionary containing the following fields:
|
||||||
| | |
|
| | |
|
||||||
| | If there's a slot at the position of the piece index, |
|
| | If there's a slot at the position of the piece index, |
|
||||||
| | the piece must be located in that slot. |
|
| | the piece must be located in that slot. |
|
||||||
|
| | |
|
||||||
+----------------------+--------------------------------------------------------------+
|
+----------------------+--------------------------------------------------------------+
|
||||||
| ``peers`` | list of dictionaries. Each dictionary has the following |
|
| ``peers`` | list of dictionaries. Each dictionary has the following |
|
||||||
| | layout: |
|
| | layout: |
|
||||||
|
@ -1409,6 +1418,7 @@ The file format is a bencoded dictionary containing the following fields:
|
||||||
| | |
|
| | |
|
||||||
| | These are the local peers we were connected to when this |
|
| | These are the local peers we were connected to when this |
|
||||||
| | fast-resume data was saved. |
|
| | fast-resume data was saved. |
|
||||||
|
| | |
|
||||||
+----------------------+--------------------------------------------------------------+
|
+----------------------+--------------------------------------------------------------+
|
||||||
| ``unfinished`` | list of dictionaries. Each dictionary represents an |
|
| ``unfinished`` | list of dictionaries. Each dictionary represents an |
|
||||||
| | piece, and has the following layout: |
|
| | piece, and has the following layout: |
|
||||||
|
@ -1435,27 +1445,30 @@ length-prefix, message-id nor extension-id).
|
||||||
|
|
||||||
__ http://nolar.com/azureus/extended.html
|
__ http://nolar.com/azureus/extended.html
|
||||||
|
|
||||||
These are the extensions that are currently implemented.
|
The extension protocol is currently disabled, since it may not be compatible
|
||||||
|
with future versions of bittorrent.
|
||||||
|
|
||||||
chat messages
|
.. These are the extensions that are currently implemented.
|
||||||
-------------
|
|
||||||
|
|
||||||
Extension name: "chat"
|
.. chat messages
|
||||||
|
.. -------------
|
||||||
|
|
||||||
The payload in the packet is a bencoded dictionary with any
|
.. Extension name: "chat"
|
||||||
combination of the following entries:
|
|
||||||
|
|
||||||
+----------+--------------------------------------------------------+
|
.. The payload in the packet is a bencoded dictionary with any
|
||||||
| "msg" | This is a string that contains a message that |
|
.. combination of the following entries:
|
||||||
| | should be displayed to the user. |
|
|
||||||
+----------+--------------------------------------------------------+
|
.. +----------+--------------------------------------------------------+
|
||||||
| "ctrl" | This is a control string that can tell a client that |
|
| "msg" | This is a string that contains a message that |
|
||||||
| | it is ignored (to make the user aware of that) and |
|
| | should be displayed to the user. |
|
||||||
| | it can also tell a client that it is no longer ignored.|
|
+----------+--------------------------------------------------------+
|
||||||
| | These notifications are encoded as the strings: |
|
| "ctrl" | This is a control string that can tell a client that |
|
||||||
| | "ignored" and "not ignored". |
|
| | it is ignored (to make the user aware of that) and |
|
||||||
| | Any unrecognized strings should be ignored. |
|
| | it can also tell a client that it is no longer ignored.|
|
||||||
+----------+--------------------------------------------------------+
|
| | These notifications are encoded as the strings: |
|
||||||
|
| | "ignored" and "not ignored". |
|
||||||
|
| | Any unrecognized strings should be ignored. |
|
||||||
|
+----------+--------------------------------------------------------+
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -64,8 +64,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
# include <eh.h>
|
# include <eh.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// TODO: if we're a seed and the peer is a seed, close the connections
|
|
||||||
|
|
||||||
namespace libtorrent
|
namespace libtorrent
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -238,6 +236,7 @@ namespace libtorrent
|
||||||
void set_upload_rate_limit(int bytes_per_second);
|
void set_upload_rate_limit(int bytes_per_second);
|
||||||
|
|
||||||
// TODO: add a session_status that contain
|
// TODO: add a session_status that contain
|
||||||
|
// some indication of if the listen-port works
|
||||||
|
|
||||||
std::auto_ptr<alert> pop_alert();
|
std::auto_ptr<alert> pop_alert();
|
||||||
void set_severity_level(alert::severity_t s);
|
void set_severity_level(alert::severity_t s);
|
||||||
|
|
|
@ -318,10 +318,7 @@ namespace libtorrent
|
||||||
// from the tracker
|
// from the tracker
|
||||||
int m_duration;
|
int m_duration;
|
||||||
|
|
||||||
// TODO: this should be a map, mapping address
|
|
||||||
// to peer_connection*
|
|
||||||
std::map<address, peer_connection*> m_connections;
|
std::map<address, peer_connection*> m_connections;
|
||||||
// std::vector<peer_connection*> m_connections;
|
|
||||||
|
|
||||||
// this is the upload and download statistics for the whole torrent.
|
// this is the upload and download statistics for the whole torrent.
|
||||||
// it's updated from all its peers once every second.
|
// it's updated from all its peers once every second.
|
||||||
|
|
|
@ -94,7 +94,7 @@ namespace libtorrent
|
||||||
ret.id[1] = 0;
|
ret.id[1] = 0;
|
||||||
++i;
|
++i;
|
||||||
|
|
||||||
if (id[8] == 45)
|
if (std::equal(id.begin()+4, id.begin()+8, "----"))
|
||||||
{
|
{
|
||||||
if (!std::isdigit(*i)) return boost::optional<fingerprint>();
|
if (!std::isdigit(*i)) return boost::optional<fingerprint>();
|
||||||
ret.major_version = *i - '0';
|
ret.major_version = *i - '0';
|
||||||
|
|
|
@ -230,7 +230,8 @@ namespace libtorrent
|
||||||
, m_send_buffer.begin() + pos + 8
|
, m_send_buffer.begin() + pos + 8
|
||||||
, 0);
|
, 0);
|
||||||
// indicate that we support the extension protocol
|
// indicate that we support the extension protocol
|
||||||
m_send_buffer[pos] = 0x80;
|
// curently disabled
|
||||||
|
// m_send_buffer[pos] = 0x80;
|
||||||
pos += 8;
|
pos += 8;
|
||||||
|
|
||||||
// info hash
|
// info hash
|
||||||
|
@ -1287,10 +1288,11 @@ namespace libtorrent
|
||||||
// TODO: if the protocol is to be extended
|
// TODO: if the protocol is to be extended
|
||||||
// these 8 bytes would be used to describe the
|
// these 8 bytes would be used to describe the
|
||||||
// extensions available on the other side
|
// extensions available on the other side
|
||||||
if (m_recv_buffer[0] & 0x80)
|
// currently disabled
|
||||||
{
|
// if (m_recv_buffer[0] & 0x80)
|
||||||
m_supports_extensions = true;
|
// {
|
||||||
}
|
// m_supports_extensions = true;
|
||||||
|
// }
|
||||||
|
|
||||||
if (m_torrent == 0)
|
if (m_torrent == 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -365,6 +365,11 @@ namespace libtorrent
|
||||||
, old_disconnected_peer())
|
, old_disconnected_peer())
|
||||||
, m_peers.end());
|
, m_peers.end());
|
||||||
|
|
||||||
|
// if the share ratio is 0 (infinite)
|
||||||
|
// m_available_free_upload isn't used
|
||||||
|
// because it isn't necessary
|
||||||
|
if (m_torrent->ratio() != 0.f)
|
||||||
|
{
|
||||||
// accumulate all the free download we get
|
// accumulate all the free download we get
|
||||||
// and add it to the available free upload
|
// and add it to the available free upload
|
||||||
m_available_free_upload
|
m_available_free_upload
|
||||||
|
@ -377,7 +382,7 @@ namespace libtorrent
|
||||||
m_torrent->begin()
|
m_torrent->begin()
|
||||||
, m_torrent->end()
|
, m_torrent->end()
|
||||||
, m_available_free_upload);
|
, m_available_free_upload);
|
||||||
|
}
|
||||||
|
|
||||||
if (m_torrent->is_seed())
|
if (m_torrent->is_seed())
|
||||||
{
|
{
|
||||||
|
@ -652,7 +657,15 @@ namespace libtorrent
|
||||||
--m_num_unchoked;
|
--m_num_unchoked;
|
||||||
unchoke_one_peer();
|
unchoke_one_peer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if the share ratio is 0 (infinite), the
|
||||||
|
// m_available_free_upload isn't used,
|
||||||
|
// because it isn't necessary.
|
||||||
|
if (m_torrent->ratio() != 0.f)
|
||||||
|
{
|
||||||
|
assert(i->connection->share_diff() < std::numeric_limits<int>::max());
|
||||||
m_available_free_upload += i->connection->share_diff();
|
m_available_free_upload += i->connection->share_diff();
|
||||||
|
}
|
||||||
i->connection = 0;
|
i->connection = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -420,7 +420,31 @@ namespace libtorrent
|
||||||
for (peer_iterator i = m_connections.begin(); i != m_connections.end(); ++i)
|
for (peer_iterator i = m_connections.begin(); i != m_connections.end(); ++i)
|
||||||
i->second->announce_piece(index);
|
i->second->announce_piece(index);
|
||||||
|
|
||||||
// TODO: if we became a seed, disconnect from all other seeds
|
// if we became a seed, disconnect from all other seeds
|
||||||
|
if (is_seed())
|
||||||
|
{
|
||||||
|
for (peer_iterator i = m_connections.begin();
|
||||||
|
i != m_connections.end();)
|
||||||
|
{
|
||||||
|
assert(i->second->associated_torrent() == this);
|
||||||
|
|
||||||
|
if (!i->second->is_seed()) continue;
|
||||||
|
|
||||||
|
detail::session_impl::connection_map::iterator j =
|
||||||
|
m_ses.m_connections.find(i->second->get_socket());
|
||||||
|
|
||||||
|
assert(j != m_ses.m_connections.end());
|
||||||
|
|
||||||
|
// in the destructor of the peer_connection
|
||||||
|
// it will remove itself from this torrent
|
||||||
|
// and from the list we're iterating over.
|
||||||
|
// so we need to increment the iterator riht
|
||||||
|
// away.
|
||||||
|
++i;
|
||||||
|
|
||||||
|
m_ses.m_connections.erase(j);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string torrent::generate_tracker_request(int port)
|
std::string torrent::generate_tracker_request(int port)
|
||||||
|
|
Loading…
Reference in New Issue