exposed some more peer info
This commit is contained in:
@@ -179,56 +179,10 @@ namespace libtorrent
|
||||
setup_send();
|
||||
}
|
||||
|
||||
void bt_peer_connection::get_peer_info(peer_info& p) const
|
||||
void bt_peer_connection::get_specific_peer_info(peer_info& p) const
|
||||
{
|
||||
assert(!associated_torrent().expired());
|
||||
|
||||
p.down_speed = statistics().download_rate();
|
||||
p.up_speed = statistics().upload_rate();
|
||||
p.payload_down_speed = statistics().download_payload_rate();
|
||||
p.payload_up_speed = statistics().upload_payload_rate();
|
||||
p.pid = pid();
|
||||
p.ip = remote();
|
||||
|
||||
#ifndef TORRENT_DISABLE_RESOLVE_COUNTRIES
|
||||
p.country[0] = m_country[0];
|
||||
p.country[1] = m_country[1];
|
||||
#endif
|
||||
|
||||
p.total_download = statistics().total_payload_download();
|
||||
p.total_upload = statistics().total_payload_upload();
|
||||
|
||||
if (m_bandwidth_limit[upload_channel].throttle() == bandwidth_limit::inf)
|
||||
p.upload_limit = -1;
|
||||
else
|
||||
p.upload_limit = m_bandwidth_limit[upload_channel].throttle();
|
||||
|
||||
if (m_bandwidth_limit[download_channel].throttle() == bandwidth_limit::inf)
|
||||
p.download_limit = -1;
|
||||
else
|
||||
p.download_limit = m_bandwidth_limit[download_channel].throttle();
|
||||
|
||||
p.load_balancing = total_free_upload();
|
||||
|
||||
p.download_queue_length = (int)download_queue().size();
|
||||
p.upload_queue_length = (int)upload_queue().size();
|
||||
|
||||
if (boost::optional<piece_block_progress> ret = downloading_piece_progress())
|
||||
{
|
||||
p.downloading_piece_index = ret->piece_index;
|
||||
p.downloading_block_index = ret->block_index;
|
||||
p.downloading_progress = ret->bytes_downloaded;
|
||||
p.downloading_total = ret->full_block_bytes;
|
||||
}
|
||||
else
|
||||
{
|
||||
p.downloading_piece_index = -1;
|
||||
p.downloading_block_index = -1;
|
||||
p.downloading_progress = 0;
|
||||
p.downloading_total = 0;
|
||||
}
|
||||
|
||||
p.flags = 0;
|
||||
if (is_interesting()) p.flags |= peer_info::interesting;
|
||||
if (is_choked()) p.flags |= peer_info::choked;
|
||||
if (is_peer_interested()) p.flags |= peer_info::remote_interested;
|
||||
@@ -240,23 +194,9 @@ namespace libtorrent
|
||||
if (is_connecting() && !is_queued()) p.flags |= peer_info::connecting;
|
||||
if (is_queued()) p.flags |= peer_info::queued;
|
||||
|
||||
p.pieces = get_bitfield();
|
||||
p.seed = is_seed();
|
||||
|
||||
p.client = m_client_version;
|
||||
p.connection_type = peer_info::standard_bittorrent;
|
||||
|
||||
if (peer_info_struct())
|
||||
{
|
||||
p.source = peer_info_struct()->source;
|
||||
p.failcount = peer_info_struct()->failcount;
|
||||
}
|
||||
else
|
||||
{
|
||||
assert(!is_local());
|
||||
p.source = 0;
|
||||
p.failcount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
bool bt_peer_connection::in_handshake() const
|
||||
|
Reference in New Issue
Block a user