fixed some bugs in session.cpp where it removed peers from the selector prematurely. made the num_peers in the torrent_status only count connected peers, and updated the docs accordingly
This commit is contained in:
parent
ec7eb0ebd6
commit
822ac4a283
|
@ -1755,7 +1755,10 @@ all peers. The rates are given as the number of bytes per second. The
|
|||
total transfer rate of payload only, not counting protocol chatter. This might
|
||||
be slightly smaller than the other rates, but if projected over a long time
|
||||
(e.g. when calculating ETA:s) the difference may be noticable.</p>
|
||||
<p><tt class="docutils literal"><span class="pre">num_peers</span></tt> is the number of peers this torrent currently is connected to.</p>
|
||||
<p><tt class="docutils literal"><span class="pre">num_peers</span></tt> is the number of peers this torrent currently is connected to.
|
||||
Peer connections that are in the half-open state (is attempting to connect)
|
||||
or are queued for later connection attempt do not count. Although they are
|
||||
visible in the peer list when you call <a class="reference" href="#get-peer-info">get_peer_info()</a>.</p>
|
||||
<p><tt class="docutils literal"><span class="pre">num_complete</span></tt> and <tt class="docutils literal"><span class="pre">num_incomplete</span></tt> are set to -1 if the tracker did not
|
||||
send any scrape data in its announce reply. This data is optional and may
|
||||
not be available from all trackers. If these are not -1, they are the total
|
||||
|
|
|
@ -1720,6 +1720,9 @@ be slightly smaller than the other rates, but if projected over a long time
|
|||
(e.g. when calculating ETA:s) the difference may be noticable.
|
||||
|
||||
``num_peers`` is the number of peers this torrent currently is connected to.
|
||||
Peer connections that are in the half-open state (is attempting to connect)
|
||||
or are queued for later connection attempt do not count. Although they are
|
||||
visible in the peer list when you call `get_peer_info()`_.
|
||||
|
||||
``num_complete`` and ``num_incomplete`` are set to -1 if the tracker did not
|
||||
send any scrape data in its announce reply. This data is optional and may
|
||||
|
|
|
@ -710,7 +710,7 @@ namespace libtorrent { namespace detail
|
|||
#endif
|
||||
|
||||
p->second->set_failed();
|
||||
m_selector.remove(*i);
|
||||
// m_selector.remove(*i);
|
||||
m_connections.erase(p);
|
||||
}
|
||||
}
|
||||
|
@ -772,6 +772,7 @@ namespace libtorrent { namespace detail
|
|||
connection_map::iterator p = m_connections.find(*i);
|
||||
if(p == m_connections.end())
|
||||
{
|
||||
assert(m_half_open.find(*i) == m_half_open.end());
|
||||
m_selector.remove(*i);
|
||||
}
|
||||
else
|
||||
|
@ -813,7 +814,7 @@ namespace libtorrent { namespace detail
|
|||
// the connection wants to disconnect for some reason, remove it
|
||||
// from the connection-list
|
||||
p->second->set_failed();
|
||||
m_selector.remove(*i);
|
||||
// m_selector.remove(*i);
|
||||
m_connections.erase(p);
|
||||
}
|
||||
}
|
||||
|
@ -834,7 +835,7 @@ namespace libtorrent { namespace detail
|
|||
{
|
||||
connection_map::iterator p = m_connections.find(*i);
|
||||
|
||||
m_selector.remove(*i);
|
||||
// m_selector.remove(*i);
|
||||
// the connection may have been disconnected in the receive or send phase
|
||||
if (p != m_connections.end())
|
||||
{
|
||||
|
@ -930,7 +931,7 @@ namespace libtorrent { namespace detail
|
|||
#endif
|
||||
|
||||
j->second->set_failed();
|
||||
m_selector.remove(j->first);
|
||||
// m_selector.remove(j->first);
|
||||
m_connections.erase(j);
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -1354,7 +1354,12 @@ namespace libtorrent
|
|||
torrent_status st;
|
||||
|
||||
st.block_size = block_size();
|
||||
st.num_peers = num_peers();
|
||||
|
||||
|
||||
st.num_peers = (int)std::count_if(m_connections.begin(), m_connections.end(),
|
||||
bind(std::logical_not<bool>(), boost::bind(&peer_connection::is_connecting,
|
||||
boost::bind(&std::map<address,peer_connection*>::value_type::second, _1))));
|
||||
|
||||
st.num_complete = m_complete;
|
||||
st.num_incomplete = m_incomplete;
|
||||
st.paused = m_paused;
|
||||
|
|
Loading…
Reference in New Issue