add peer_info::progress

This commit is contained in:
Andrew Resch 2008-09-25 20:39:06 +00:00
parent a3751cfcbe
commit 4189e0b697
4 changed files with 9 additions and 0 deletions

View File

@ -89,6 +89,7 @@ void bind_peer_info()
.def_readonly("send_quota", &peer_info::send_quota)
.def_readonly("receive_quota", &peer_info::receive_quota)
.def_readonly("rtt", &peer_info::rtt)
.def_readonly("progress", &peer_info::progress)
;
// flags

View File

@ -2687,6 +2687,7 @@ It contains the following fields::
int download_rate_peak;
int upload_rate_peak;
float progress;
};
The ``flags`` attribute tells you in which state the peer is. It is set to
@ -2906,6 +2907,8 @@ estimated by timing the the tcp ``connect()``. It may be 0 for incoming connecti
rates seen on this connection. They are given in bytes per second. This number is
reset to 0 on reconnect.
``progress`` is the progress of the peer.
session_settings
================

View File

@ -196,6 +196,9 @@ namespace libtorrent
// the highest transfer rates seen for this peer
int download_rate_peak;
int upload_rate_peak;
// the peers progress
float progress;
};
struct TORRENT_EXPORT peer_list_entry

View File

@ -2672,6 +2672,8 @@ namespace libtorrent
p.used_receive_buffer = m_recv_pos;
p.write_state = m_channel_state[upload_channel];
p.read_state = m_channel_state[download_channel];
p.progress = (float)p.pieces.count() / (float)p.pieces.size();
}
// allocates a disk buffer of size 'disk_buffer_size' and replaces the