*** empty log message ***

This commit is contained in:
Arvid Norberg 2004-01-05 02:30:50 +00:00
parent d43380d579
commit 2274c82c61
3 changed files with 103 additions and 67 deletions

View File

@ -27,45 +27,50 @@
<li><a class="reference" href="#introduction" id="id8" name="id8">introduction</a></li>
<li><a class="reference" href="#building" id="id9" name="id9">building</a></li>
<li><a class="reference" href="#using" id="id10" name="id10">using</a><ul>
<li><a class="reference" href="#session" id="id11" name="id11">session</a></li>
<li><a class="reference" href="#parsing-torrent-files" id="id12" name="id12">parsing torrent files</a></li>
<li><a class="reference" href="#entry" id="id13" name="id13">entry</a></li>
<li><a class="reference" href="#torrent-info" id="id14" name="id14">torrent_info</a></li>
<li><a class="reference" href="#torrent-handle" id="id15" name="id15">torrent_handle</a><ul>
<li><a class="reference" href="#status" id="id16" name="id16">status()</a></li>
<li><a class="reference" href="#get-download-queue" id="id17" name="id17">get_download_queue()</a></li>
<li><a class="reference" href="#get-peer-info" id="id18" name="id18">get_peer_info()</a></li>
<li><a class="reference" href="#get-torrent-info" id="id19" name="id19">get_torrent_info()</a></li>
<li><a class="reference" href="#is-valid" id="id20" name="id20">is_valid()</a></li>
<li><a class="reference" href="#session" id="id11" name="id11">session</a><ul>
<li><a class="reference" href="#tracker-alert" id="id12" name="id12">tracker_alert</a></li>
<li><a class="reference" href="#hash-failed-alert" id="id13" name="id13">hash_failed_alert</a></li>
<li><a class="reference" href="#peer-error-alert" id="id14" name="id14">peer_error_alert</a></li>
</ul>
</li>
<li><a class="reference" href="#address" id="id21" name="id21">address</a></li>
<li><a class="reference" href="#http-settings" id="id22" name="id22">http_settings</a></li>
<li><a class="reference" href="#big-number" id="id23" name="id23">big_number</a></li>
<li><a class="reference" href="#hasher" id="id24" name="id24">hasher</a></li>
<li><a class="reference" href="#fingerprint" id="id25" name="id25">fingerprint</a></li>
<li><a class="reference" href="#alert" id="id26" name="id26">alert</a></li>
<li><a class="reference" href="#exceptions" id="id27" name="id27">exceptions</a><ul>
<li><a class="reference" href="#invalid-handle" id="id28" name="id28">invalid_handle</a></li>
<li><a class="reference" href="#duplicate-torrent" id="id29" name="id29">duplicate_torrent</a></li>
<li><a class="reference" href="#invalid-encoding" id="id30" name="id30">invalid_encoding</a></li>
<li><a class="reference" href="#type-error" id="id31" name="id31">type_error</a></li>
<li><a class="reference" href="#invalid-torrent-file" id="id32" name="id32">invalid_torrent_file</a></li>
<li><a class="reference" href="#parsing-torrent-files" id="id15" name="id15">parsing torrent files</a></li>
<li><a class="reference" href="#entry" id="id16" name="id16">entry</a></li>
<li><a class="reference" href="#torrent-info" id="id17" name="id17">torrent_info</a></li>
<li><a class="reference" href="#torrent-handle" id="id18" name="id18">torrent_handle</a><ul>
<li><a class="reference" href="#status" id="id19" name="id19">status()</a></li>
<li><a class="reference" href="#get-download-queue" id="id20" name="id20">get_download_queue()</a></li>
<li><a class="reference" href="#get-peer-info" id="id21" name="id21">get_peer_info()</a></li>
<li><a class="reference" href="#get-torrent-info" id="id22" name="id22">get_torrent_info()</a></li>
<li><a class="reference" href="#is-valid" id="id23" name="id23">is_valid()</a></li>
</ul>
</li>
<li><a class="reference" href="#example-usage" id="id33" name="id33">example usage</a><ul>
<li><a class="reference" href="#dump-torrent" id="id34" name="id34">dump_torrent</a></li>
<li><a class="reference" href="#simple-client" id="id35" name="id35">simple client</a></li>
<li><a class="reference" href="#address" id="id24" name="id24">address</a></li>
<li><a class="reference" href="#http-settings" id="id25" name="id25">http_settings</a></li>
<li><a class="reference" href="#big-number" id="id26" name="id26">big_number</a></li>
<li><a class="reference" href="#hasher" id="id27" name="id27">hasher</a></li>
<li><a class="reference" href="#fingerprint" id="id28" name="id28">fingerprint</a></li>
<li><a class="reference" href="#alert" id="id29" name="id29">alert</a></li>
<li><a class="reference" href="#exceptions" id="id30" name="id30">exceptions</a><ul>
<li><a class="reference" href="#invalid-handle" id="id31" name="id31">invalid_handle</a></li>
<li><a class="reference" href="#duplicate-torrent" id="id32" name="id32">duplicate_torrent</a></li>
<li><a class="reference" href="#invalid-encoding" id="id33" name="id33">invalid_encoding</a></li>
<li><a class="reference" href="#type-error" id="id34" name="id34">type_error</a></li>
<li><a class="reference" href="#invalid-torrent-file" id="id35" name="id35">invalid_torrent_file</a></li>
</ul>
</li>
<li><a class="reference" href="#fast-resume" id="id36" name="id36">fast resume</a><ul>
<li><a class="reference" href="#file-format" id="id37" name="id37">file format</a></li>
<li><a class="reference" href="#example-usage" id="id36" name="id36">example usage</a><ul>
<li><a class="reference" href="#dump-torrent" id="id37" name="id37">dump_torrent</a></li>
<li><a class="reference" href="#simple-client" id="id38" name="id38">simple client</a></li>
</ul>
</li>
<li><a class="reference" href="#fast-resume" id="id39" name="id39">fast resume</a><ul>
<li><a class="reference" href="#file-format" id="id40" name="id40">file format</a></li>
</ul>
</li>
</ul>
</li>
<li><a class="reference" href="#feedback" id="id38" name="id38">Feedback</a></li>
<li><a class="reference" href="#aknowledgements" id="id39" name="id39">Aknowledgements</a></li>
<li><a class="reference" href="#feedback" id="id41" name="id41">Feedback</a></li>
<li><a class="reference" href="#aknowledgements" id="id42" name="id42">Aknowledgements</a></li>
</ul>
</div>
<div class="section" id="introduction">
@ -276,15 +281,13 @@ any events at all.</p>
information on exactly which type it is. i.e. what kind of error it is. You can also use a
dispatcher mechanism that's available in libtorrent.</p>
<p>TODO: describe the type dispatching mechanism</p>
<p>The currently available alert types are:</p>
<blockquote>
<ul class="simple">
<li>tracker_alert</li>
<li>hash_failed_alert</li>
</ul>
</blockquote>
<p>You can try a <tt class="literal"><span class="pre">dynamic_cast</span></tt> to these types to get more message-pecific information. Here
are their definitions:</p>
<p>You can do a <tt class="literal"><span class="pre">dynamic_cast</span></tt> to a specific alert type to get more message-specific information.
These are the different alert types.</p>
<div class="section" id="tracker-alert">
<h3><a class="toc-backref" href="#id12" name="tracker-alert">tracker_alert</a></h3>
<p>This alert is generated on tracker time outs, premature disconnects, invalid response or
a HTTP response other than &quot;200 OK&quot;. From the alert you can get the handle to the torrent
the tracker belongs to. This alert is generated as severity level <tt class="literal"><span class="pre">warning</span></tt>.</p>
<pre class="literal-block">
struct tracker_alert: alert
{
@ -293,7 +296,14 @@ struct tracker_alert: alert
torrent_handle handle;
};
</pre>
</div>
<div class="section" id="hash-failed-alert">
<h3><a class="toc-backref" href="#id13" name="hash-failed-alert">hash_failed_alert</a></h3>
<p>This alert is generated when a finished piece fails its hash check. You can get the handle
to the torrent which got the failed piece and the index of the piece itself from the alert.
This alert is generated as severity level <tt class="literal"><span class="pre">info</span></tt>.</p>
<pre class="literal-block">
struct hash_failed_alert: alert
{
hash_failed_alert(
@ -308,8 +318,24 @@ struct hash_failed_alert: alert
};
</pre>
</div>
<div class="section" id="peer-error-alert">
<h3><a class="toc-backref" href="#id14" name="peer-error-alert">peer_error_alert</a></h3>
<p>This alert is generated when a peer sends invalid data over the peer-peer protocol. The peer
will be disconnected, but you get its peer-id from the alert. This alert is generated
as severity level <tt class="literal"><span class="pre">debug</span></tt>.</p>
<pre class="literal-block">
struct peer_error_alert: alert
{
peer_error_alert(const peer_id&amp; pid, const std::string&amp; msg);
virtual std::auto_ptr&lt;alert&gt; clone() const;
peer_id id;
};
</pre>
</div>
</div>
<div class="section" id="parsing-torrent-files">
<h2><a class="toc-backref" href="#id12" name="parsing-torrent-files">parsing torrent files</a></h2>
<h2><a class="toc-backref" href="#id15" name="parsing-torrent-files">parsing torrent files</a></h2>
<p>The torrent files are <a class="reference" href="http://bitconjurer.org/BitTorrent/protocol.html">bencoded</a>. There are two functions in libtorrent that can encode and decode
bencoded data. They are:</p>
<pre class="literal-block">
@ -348,7 +374,7 @@ entry e = bdecode(buf, buf + data_size);
it will throw <a class="reference" href="#invalid-encoding">invalid_encoding</a>.</p>
</div>
<div class="section" id="entry">
<h2><a class="toc-backref" href="#id13" name="entry">entry</a></h2>
<h2><a class="toc-backref" href="#id16" name="entry">entry</a></h2>
<p>The <tt class="literal"><span class="pre">entry</span></tt> class represents one node in a bencoded hierarchy. It works as a
variant type, it can be either a list, a dictionary (<tt class="literal"><span class="pre">std::map</span></tt>), an integer
or a string. This is its synopsis:</p>
@ -418,7 +444,7 @@ if (i != dict.end())
exists.</p>
</div>
<div class="section" id="torrent-info">
<h2><a class="toc-backref" href="#id14" name="torrent-info">torrent_info</a></h2>
<h2><a class="toc-backref" href="#id17" name="torrent-info">torrent_info</a></h2>
<p>The <tt class="literal"><span class="pre">torrent_info</span></tt> has the following synopsis:</p>
<pre class="literal-block">
class torrent_info
@ -505,7 +531,7 @@ object, representing the time when this torrent file was created. If there's no
in the torrent file, this will return a date of january 1:st 1970.</p>
</div>
<div class="section" id="torrent-handle">
<h2><a class="toc-backref" href="#id15" name="torrent-handle">torrent_handle</a></h2>
<h2><a class="toc-backref" href="#id18" name="torrent-handle">torrent_handle</a></h2>
<p>You will usually have to store your torrent handles somewhere, since it's the
object through which you retrieve infromation about the torrent and aborts the torrent.
Its declaration looks like this:</p>
@ -544,7 +570,7 @@ torrent. If you set this to -1, there will be no limit.</p>
<p><tt class="literal"><span class="pre">write_resume_data()</span></tt> takes a non-const reference to a char-vector, that vector will be filled
with the fast-resume data. For more information about how fast-resume works, see <a class="reference" href="#fast-resume">fast resume</a>.</p>
<div class="section" id="status">
<h3><a class="toc-backref" href="#id16" name="status">status()</a></h3>
<h3><a class="toc-backref" href="#id19" name="status">status()</a></h3>
<p><tt class="literal"><span class="pre">status()</span></tt> will return a structure with information about the status of this
torrent. If the <a class="reference" href="#torrent-handle">torrent_handle</a> is invalid, it will throw <a class="reference" href="#invalid-handle">invalid_handle</a> exception.
It contains the following fields:</p>
@ -626,7 +652,7 @@ all peers. The rates are given as the number of bytes per second.</p>
<p><tt class="literal"><span class="pre">total_done</span></tt> is the total number of bytes of the file(s) that we have.</p>
</div>
<div class="section" id="get-download-queue">
<h3><a class="toc-backref" href="#id17" name="get-download-queue">get_download_queue()</a></h3>
<h3><a class="toc-backref" href="#id20" name="get-download-queue">get_download_queue()</a></h3>
<p><tt class="literal"><span class="pre">get_download_queue()</span></tt> takes a non-const reference to a vector which it will fill
information about pieces that are partially downloaded or not downloaded at all but partially
requested. The entry in the vector (<tt class="literal"><span class="pre">partial_piece_info</span></tt>) looks like this:</p>
@ -658,7 +684,7 @@ When a piece fails a hash verification, single blocks may be redownloaded to see
may pass then.</p>
</div>
<div class="section" id="get-peer-info">
<h3><a class="toc-backref" href="#id18" name="get-peer-info">get_peer_info()</a></h3>
<h3><a class="toc-backref" href="#id21" name="get-peer-info">get_peer_info()</a></h3>
<p><tt class="literal"><span class="pre">get_peer_info()</span></tt> takes a reference to a vector that will be cleared and filled
with one entry for each peer connected to this torrent, given the handle is valid. If the
<a class="reference" href="#torrent-handle">torrent_handle</a> is invalid, it will throw <tt class="literal"><span class="pre">invalid_handle</span></tt> exception. Each entry in
@ -735,19 +761,19 @@ of bytes of this block we have received from the peer, and <tt class="literal"><
the total number of bytes in this block.</p>
</div>
<div class="section" id="get-torrent-info">
<h3><a class="toc-backref" href="#id19" name="get-torrent-info">get_torrent_info()</a></h3>
<h3><a class="toc-backref" href="#id22" name="get-torrent-info">get_torrent_info()</a></h3>
<p>Returns a const reference to the <tt class="literal"><span class="pre">torrent_info</span></tt> object associated with this torrent.
This reference is valid as long as the <a class="reference" href="#torrent-handle">torrent_handle</a> is valid, no longer. If the
<a class="reference" href="#torrent-handle">torrent_handle</a> is invalid, <a class="reference" href="#invalid-handle">invalid_handle</a> exception will be thrown.</p>
</div>
<div class="section" id="is-valid">
<h3><a class="toc-backref" href="#id20" name="is-valid">is_valid()</a></h3>
<h3><a class="toc-backref" href="#id23" name="is-valid">is_valid()</a></h3>
<p>Returns true if this handle refers to a valid torrent and false if it hasn't been initialized
or if the torrent it refers to has been aborted.</p>
</div>
</div>
<div class="section" id="address">
<h2><a class="toc-backref" href="#id21" name="address">address</a></h2>
<h2><a class="toc-backref" href="#id24" name="address">address</a></h2>
<p>The <tt class="literal"><span class="pre">address</span></tt> class represents a name of a network endpoint (usually referred to as
IP-address) and a port number. This is the same thing as a <tt class="literal"><span class="pre">sockaddr_in</span></tt> would contain.
Its declaration looks like this:</p>
@ -780,7 +806,7 @@ while it does the DNS lookup, it returns a string that points to the address rep
<p><tt class="literal"><span class="pre">ip()</span></tt> will return the 32-bit ip-address as an integer. <tt class="literal"><span class="pre">port()</span></tt> returns the port number.</p>
</div>
<div class="section" id="http-settings">
<h2><a class="toc-backref" href="#id22" name="http-settings">http_settings</a></h2>
<h2><a class="toc-backref" href="#id25" name="http-settings">http_settings</a></h2>
<p>You have some control over tracker requests through the <tt class="literal"><span class="pre">http_settings</span></tt> object. You
create it and fill it with your settings and the use <tt class="literal"><span class="pre">session::set_http_settings()</span></tt>
to apply them. You have control over proxy and authorization settings and also the user-agent
@ -820,7 +846,7 @@ uncompressed (given your limit is lower than 2 megs). Default limit is
1 megabyte.</p>
</div>
<div class="section" id="big-number">
<h2><a class="toc-backref" href="#id23" name="big-number">big_number</a></h2>
<h2><a class="toc-backref" href="#id26" name="big-number">big_number</a></h2>
<p>Both the <tt class="literal"><span class="pre">peer_id</span></tt> and <tt class="literal"><span class="pre">sha1_hash</span></tt> types are typedefs of the class
<tt class="literal"><span class="pre">big_number</span></tt>. It represents 20 bytes of data. Its synopsis follows:</p>
<pre class="literal-block">
@ -841,7 +867,7 @@ public:
<p>The iterators gives you access to individual bytes.</p>
</div>
<div class="section" id="hasher">
<h2><a class="toc-backref" href="#id24" name="hasher">hasher</a></h2>
<h2><a class="toc-backref" href="#id27" name="hasher">hasher</a></h2>
<p>This class creates sha1-hashes. Its declaration looks like this:</p>
<pre class="literal-block">
class hasher
@ -865,7 +891,7 @@ call <tt class="literal"><span class="pre">reset()</span></tt> to reinitialize i
For more info, see <tt class="literal"><span class="pre">src/sha1.c</span></tt>.</p>
</div>
<div class="section" id="fingerprint">
<h2><a class="toc-backref" href="#id25" name="fingerprint">fingerprint</a></h2>
<h2><a class="toc-backref" href="#id28" name="fingerprint">fingerprint</a></h2>
<p>The fingerprint class represents information about a client and its version. It is used
to encode this information into the client's peer id.</p>
<p>This is the class declaration:</p>
@ -907,6 +933,9 @@ sure not to clash with anybody else. Here are some taken id's:</p>
<tr><td>'BX'</td>
<td>BittorrentX</td>
</tr>
<tr><td>'MT'</td>
<td>Moonlight Torrent</td>
</tr>
</tbody>
</table>
<p>The <tt class="literal"><span class="pre">major</span></tt>, <tt class="literal"><span class="pre">minor</span></tt>, <tt class="literal"><span class="pre">revision</span></tt> and <tt class="literal"><span class="pre">tag</span></tt> parameters are used to identify the
@ -914,7 +943,7 @@ version of your client. All these numbers must be within the range [0, 9].</p>
<p><tt class="literal"><span class="pre">to_string()</span></tt> will generate the actual string put in the peer-id, and return it.</p>
</div>
<div class="section" id="alert">
<h2><a class="toc-backref" href="#id26" name="alert">alert</a></h2>
<h2><a class="toc-backref" href="#id29" name="alert">alert</a></h2>
<p>The <tt class="literal"><span class="pre">alert</span></tt> class is used to pass messages of events from the libtorrent code
to the user. It is a base class that specific messages are derived from. This
is its synopsis:</p>
@ -937,11 +966,11 @@ public:
</pre>
</div>
<div class="section" id="exceptions">
<h2><a class="toc-backref" href="#id27" name="exceptions">exceptions</a></h2>
<h2><a class="toc-backref" href="#id30" name="exceptions">exceptions</a></h2>
<p>There are a number of exceptions that can be thrown from different places in libtorrent,
here's a complete list with description.</p>
<div class="section" id="invalid-handle">
<h3><a class="toc-backref" href="#id28" name="invalid-handle">invalid_handle</a></h3>
<h3><a class="toc-backref" href="#id31" name="invalid-handle">invalid_handle</a></h3>
<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>
<pre class="literal-block">
@ -952,7 +981,7 @@ struct invalid_handle: std::exception
</pre>
</div>
<div class="section" id="duplicate-torrent">
<h3><a class="toc-backref" href="#id29" name="duplicate-torrent">duplicate_torrent</a></h3>
<h3><a class="toc-backref" href="#id32" name="duplicate-torrent">duplicate_torrent</a></h3>
<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>
<pre class="literal-block">
@ -963,7 +992,7 @@ struct duplicate_torrent: std::exception
</pre>
</div>
<div class="section" id="invalid-encoding">
<h3><a class="toc-backref" href="#id30" name="invalid-encoding">invalid_encoding</a></h3>
<h3><a class="toc-backref" href="#id33" name="invalid-encoding">invalid_encoding</a></h3>
<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">
struct invalid_encoding: std::exception
@ -973,7 +1002,7 @@ struct invalid_encoding: std::exception
</pre>
</div>
<div class="section" id="type-error">
<h3><a class="toc-backref" href="#id31" name="type-error">type_error</a></h3>
<h3><a class="toc-backref" href="#id34" name="type-error">type_error</a></h3>
<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>
<pre class="literal-block">
@ -984,7 +1013,7 @@ struct type_error: std::runtime_error
</pre>
</div>
<div class="section" id="invalid-torrent-file">
<h3><a class="toc-backref" href="#id32" name="invalid-torrent-file">invalid_torrent_file</a></h3>
<h3><a class="toc-backref" href="#id35" name="invalid-torrent-file">invalid_torrent_file</a></h3>
<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>
<pre class="literal-block">
@ -996,9 +1025,9 @@ struct invalid_torrent_file: std::exception
</div>
</div>
<div class="section" id="example-usage">
<h2><a class="toc-backref" href="#id33" name="example-usage">example usage</a></h2>
<h2><a class="toc-backref" href="#id36" name="example-usage">example usage</a></h2>
<div class="section" id="dump-torrent">
<h3><a class="toc-backref" href="#id34" name="dump-torrent">dump_torrent</a></h3>
<h3><a class="toc-backref" href="#id37" name="dump-torrent">dump_torrent</a></h3>
<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>
<pre class="literal-block">
@ -1062,7 +1091,7 @@ int main(int argc, char* argv[])
</pre>
</div>
<div class="section" id="simple-client">
<h3><a class="toc-backref" href="#id35" name="simple-client">simple client</a></h3>
<h3><a class="toc-backref" href="#id38" name="simple-client">simple client</a></h3>
<p>This is a simple client. It doesn't have much output to keep it simple:</p>
<pre class="literal-block">
#include &lt;iostream&gt;
@ -1114,7 +1143,7 @@ int main(int argc, char* argv[])
</div>
</div>
<div class="section" id="fast-resume">
<h2><a class="toc-backref" href="#id36" name="fast-resume">fast resume</a></h2>
<h2><a class="toc-backref" href="#id39" name="fast-resume">fast resume</a></h2>
<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
<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
@ -1127,7 +1156,7 @@ will skip the time consuming checks. It may have to do the checking anyway, if t
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>
<div class="section" id="file-format">
<h3><a class="toc-backref" href="#id37" name="file-format">file format</a></h3>
<h3><a class="toc-backref" href="#id40" name="file-format">file format</a></h3>
<p>The format of the fast-resume data is as follows, given that all
4-byte integers are stored as big-endian:</p>
<pre class="literal-block">
@ -1150,12 +1179,12 @@ for each unfinished piece
</div>
</div>
<div class="section" id="feedback">
<h1><a class="toc-backref" href="#id38" name="feedback">Feedback</a></h1>
<h1><a class="toc-backref" href="#id41" name="feedback">Feedback</a></h1>
<p>There's a <a class="reference" href="http://lists.sourceforge.net/lists/listinfo/libtorrent-discuss">mailing list</a>.</p>
<p>You can usually find me as hydri in <tt class="literal"><span class="pre">#btports</span> <span class="pre">&#64;</span> <span class="pre">irc.freenode.net</span></tt>.</p>
</div>
<div class="section" id="aknowledgements">
<h1><a class="toc-backref" href="#id39" name="aknowledgements">Aknowledgements</a></h1>
<h1><a class="toc-backref" href="#id42" name="aknowledgements">Aknowledgements</a></h1>
<p>Written by Arvid Norberg and Daniel Wallin. Copyright (c) 2003</p>
<p>Contributions by Magnus Jonsson</p>
<p>Thanks to Reimond Retz for bugfixes, suggestions and testing</p>

View File

@ -983,6 +983,9 @@ sure not to clash with anybody else. Here are some taken id's:
+----------+-----------------------+
| 'BX' | BittorrentX |
+----------+-----------------------+
| 'MT' | Moonlight Torrent |
+----------+-----------------------+
The ``major``, ``minor``, ``revision`` and ``tag`` parameters are used to identify the
version of your client. All these numbers must be within the range [0, 9].

View File

@ -157,6 +157,10 @@ namespace libtorrent
else if (std::equal(f->id, f->id+2, "LT"))
identity << "libtorrent ";
// Moonlight Torrent
else if (std::equal(f->id, f->id+2, "MT"))
identity << "Moonlight Torrent ";
// unknown client
else
identity << std::string(f->id, f->id+2) << " ";