exposed upload_only in peer_info

This commit is contained in:
Arvid Norberg 2008-07-19 07:57:43 +00:00
parent 49e76f510f
commit 7607034ab6
6 changed files with 26 additions and 3 deletions

View File

@ -360,6 +360,8 @@ API is used.</li>
<li><tt class="docutils literal"><span class="pre">off</span></tt> - internal invariant checks are
disabled. The resulting executable will run
faster than a regular debug build.</li>
<li><tt class="docutils literal"><span class="pre">full</span></tt> - turns on extra expensive invariant
checks.</li>
</ul>
</td>
</tr>
@ -520,8 +522,8 @@ invariant checks and asserts built into it. If you want to disable such checks
defines you can use to control the build.</p>
<table border="1" class="docutils">
<colgroup>
<col width="44%" />
<col width="56%" />
<col width="45%" />
<col width="55%" />
</colgroup>
<thead valign="bottom">
<tr><th class="head">macro</th>
@ -648,6 +650,11 @@ very well. This option can be used to still
build in debug mode, with asserts enabled, but
make the resulting executable faster.</td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">TORRENT_EXPENSIVE_INVARIANT_CHECKS</span></tt></td>
<td>This will enable extra expensive invariant
checks. Useful for finding particular bugs
or for running before releases.</td>
</tr>
</tbody>
</table>
<p>If you experience that libtorrent uses unreasonable amounts of cpu, it will

View File

@ -2524,6 +2524,7 @@ struct peer_info
seed = 0x400,
optimistic_unchoke = 0x800,
snubbed = 0x1000,
upload_only = 0x2000,
rc4_encrypted = 0x100000,
plaintext_encrypted = 0x200000
};
@ -2678,6 +2679,12 @@ the request timeout from when the request was sent.
We're currently picking one block at a time from this
peer.</td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">upload_only</span></tt></td>
<td>This peer has either explicitly (with an extension)
or implicitly (by becoming a seed) told us that it
will not downloading anything more, regardless of
which pieces we have.</td>
</tr>
</tbody>
</table>
<p><tt class="docutils literal"><span class="pre">source</span></tt> is a combination of flags describing from which sources this peer

View File

@ -2502,6 +2502,7 @@ It contains the following fields::
seed = 0x400,
optimistic_unchoke = 0x800,
snubbed = 0x1000,
upload_only = 0x2000,
rc4_encrypted = 0x100000,
plaintext_encrypted = 0x200000
};
@ -2639,6 +2640,11 @@ any combination of the enums above. The following table describes each flag:
| | We're currently picking one block at a time from this |
| | peer. |
+-------------------------+-------------------------------------------------------+
| ``upload_only`` | This peer has either explicitly (with an extension) |
| | or implicitly (by becoming a seed) told us that it |
| | will not downloading anything more, regardless of |
| | which pieces we have. |
+-------------------------+-------------------------------------------------------+
__ extension_protocol.html

View File

@ -381,6 +381,7 @@ void print_peer_info(std::ostream& out, std::vector<libtorrent::peer_info> const
(i->write_state == peer_info::bw_global)?'w':
(i->write_state == peer_info::bw_network)?'W':'.')
<< ((i->flags & peer_info::snubbed)?'S':'.')
<< ((i->flags & peer_info::upload_only)?'U':'D')
#ifndef TORRENT_DISABLE_ENCRYPTION
<< ((i->flags & peer_info::rc4_encrypted)?'E':
(i->flags & peer_info::plaintext_encrypted)?'e':'.')

View File

@ -57,7 +57,8 @@ namespace libtorrent
on_parole = 0x200,
seed = 0x400,
optimistic_unchoke = 0x800,
snubbed = 0x1000
snubbed = 0x1000,
upload_only = 0x2000
#ifndef TORRENT_DISABLE_ENCRYPTION
, rc4_encrypted = 0x100000,
plaintext_encrypted = 0x200000

View File

@ -2497,6 +2497,7 @@ namespace libtorrent
p.flags |= is_seed() ? peer_info::seed : 0;
p.flags |= m_snubbed ? peer_info::snubbed : 0;
p.flags |= m_upload_only ? peer_info::upload_only : 0;
if (peer_info_struct())
{
policy::peer* pi = peer_info_struct();