generalized peer read/write state
This commit is contained in:
@@ -2218,10 +2218,6 @@ struct peer_info
|
||||
on_parole = 0x200,
|
||||
seed = 0x400,
|
||||
optimistic_unchoke = 0x800,
|
||||
writing = 0x1000,
|
||||
reading = 0x2000,
|
||||
waiting_write_quota = 0x4000,
|
||||
waiting_read_quota = 0x8000,
|
||||
rc4_encrypted = 0x100000,
|
||||
plaintext_encrypted = 0x200000
|
||||
};
|
||||
@@ -2238,6 +2234,11 @@ struct peer_info
|
||||
|
||||
int source;
|
||||
|
||||
enum bw_state { bw_idle, bw_torrent, bw_global, bw_network };
|
||||
|
||||
char read_state;
|
||||
char write_state;
|
||||
|
||||
asio::ip::tcp::endpoint ip;
|
||||
float up_speed;
|
||||
float down_speed;
|
||||
@@ -2396,6 +2397,36 @@ discovery (The peer is on the local network).</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><tt class="docutils literal"><span class="pre">read_state</span></tt> and <tt class="docutils literal"><span class="pre">write_state</span></tt> indicates what state this peer is in with regards
|
||||
to sending and receiving data. The states are declared in the <tt class="docutils literal"><span class="pre">bw_state</span></tt> enum and
|
||||
defines as follows:</p>
|
||||
<table border="1" class="docutils">
|
||||
<colgroup>
|
||||
<col width="30%" />
|
||||
<col width="70%" />
|
||||
</colgroup>
|
||||
<tbody valign="top">
|
||||
<tr><td><tt class="docutils literal"><span class="pre">bw_idle</span></tt></td>
|
||||
<td>The peer is not waiting for any external events to
|
||||
send or receive data.</td>
|
||||
</tr>
|
||||
<tr><td><tt class="docutils literal"><span class="pre">bw_torrent</span></tt></td>
|
||||
<td>The peer is waiting for the torrent to receive
|
||||
bandwidth quota in order to forward the bandwidth
|
||||
request to the global manager.</td>
|
||||
</tr>
|
||||
<tr><td><tt class="docutils literal"><span class="pre">bw_global</span></tt></td>
|
||||
<td>The peer is waiting for the global bandwidth manager
|
||||
to receive more quota in order to handle the request.</td>
|
||||
</tr>
|
||||
<tr><td><tt class="docutils literal"><span class="pre">bw_network</span></tt></td>
|
||||
<td>The peer has quota and is currently waiting for a
|
||||
network read or write operation to complete. This is
|
||||
the state all peers are in if there are no bandwidth
|
||||
limits.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p>The <tt class="docutils literal"><span class="pre">ip</span></tt> field is the IP-address to this peer. The type is an asio endpoint. For
|
||||
more info, see the <a class="reference" href="http://asio.sf.net">asio</a> documentation.</p>
|
||||
<p><tt class="docutils literal"><span class="pre">up_speed</span></tt> and <tt class="docutils literal"><span class="pre">down_speed</span></tt> contains the current upload and download speed
|
||||
|
@@ -2208,10 +2208,6 @@ It contains the following fields::
|
||||
on_parole = 0x200,
|
||||
seed = 0x400,
|
||||
optimistic_unchoke = 0x800,
|
||||
writing = 0x1000,
|
||||
reading = 0x2000,
|
||||
waiting_write_quota = 0x4000,
|
||||
waiting_read_quota = 0x8000,
|
||||
rc4_encrypted = 0x100000,
|
||||
plaintext_encrypted = 0x200000
|
||||
};
|
||||
@@ -2228,6 +2224,11 @@ It contains the following fields::
|
||||
|
||||
int source;
|
||||
|
||||
enum bw_state { bw_idle, bw_torrent, bw_global, bw_network };
|
||||
|
||||
char read_state;
|
||||
char write_state;
|
||||
|
||||
asio::ip::tcp::endpoint ip;
|
||||
float up_speed;
|
||||
float down_speed;
|
||||
@@ -2357,6 +2358,31 @@ was received. The flags are:
|
||||
| ``resume_data`` | The peer was added from the fast resume data. |
|
||||
+------------------------+--------------------------------------------------------+
|
||||
|
||||
``read_state`` and ``write_state`` indicates what state this peer is in with regards
|
||||
to sending and receiving data. The states are declared in the ``bw_state`` enum and
|
||||
defines as follows:
|
||||
|
||||
+------------------------+--------------------------------------------------------+
|
||||
| ``bw_idle`` | The peer is not waiting for any external events to |
|
||||
| | send or receive data. |
|
||||
| | |
|
||||
+------------------------+--------------------------------------------------------+
|
||||
| ``bw_torrent`` | The peer is waiting for the torrent to receive |
|
||||
| | bandwidth quota in order to forward the bandwidth |
|
||||
| | request to the global manager. |
|
||||
| | |
|
||||
+------------------------+--------------------------------------------------------+
|
||||
| ``bw_global`` | The peer is waiting for the global bandwidth manager |
|
||||
| | to receive more quota in order to handle the request. |
|
||||
| | |
|
||||
+------------------------+--------------------------------------------------------+
|
||||
| ``bw_network`` | The peer has quota and is currently waiting for a |
|
||||
| | network read or write operation to complete. This is |
|
||||
| | the state all peers are in if there are no bandwidth |
|
||||
| | limits. |
|
||||
| | |
|
||||
+------------------------+--------------------------------------------------------+
|
||||
|
||||
The ``ip`` field is the IP-address to this peer. The type is an asio endpoint. For
|
||||
more info, see the asio_ documentation.
|
||||
|
||||
|
Reference in New Issue
Block a user