deprecate and remove remote_dl_rate feature (#1051)
deprecate and remove remote_dl_rate feature
This commit is contained in:
parent
c310d15cac
commit
5f5589d137
|
@ -1,3 +1,4 @@
|
|||
* remove remote_dl_rate feature
|
||||
* source code migration from boost::shared_ptr to std::shared_ptr
|
||||
* storage_interface API changed to use span and references
|
||||
* changes in public API to work with std::shared_ptr<torrent_info>
|
||||
|
|
|
@ -67,6 +67,7 @@ void bind_peer_info()
|
|||
.def_readonly("upload_limit", &peer_info::upload_limit)
|
||||
.def_readonly("download_limit", &peer_info::download_limit)
|
||||
.def_readonly("load_balancing", &peer_info::load_balancing)
|
||||
.def_readonly("remote_dl_rate", &peer_info::remote_dl_rate)
|
||||
#endif
|
||||
.add_property("last_request", get_last_request)
|
||||
.add_property("last_active", get_last_active)
|
||||
|
@ -87,7 +88,6 @@ void bind_peer_info()
|
|||
.def_readonly("downloading_total", &peer_info::downloading_total)
|
||||
.def_readonly("client", &peer_info::client)
|
||||
.def_readonly("connection_type", &peer_info::connection_type)
|
||||
.def_readonly("remote_dl_rate", &peer_info::remote_dl_rate)
|
||||
.def_readonly("pending_disk_bytes", &peer_info::pending_disk_bytes)
|
||||
.def_readonly("send_quota", &peer_info::send_quota)
|
||||
.def_readonly("receive_quota", &peer_info::receive_quota)
|
||||
|
|
|
@ -395,7 +395,7 @@ int print_peer_info(std::string& out
|
|||
if (print_timers) out += "inactive wait timeout q-time ";
|
||||
out += " v disk ^ rtt ";
|
||||
if (print_block) out += "block-progress ";
|
||||
if (print_peer_rate) out += "peer-rate est.rec.rate ";
|
||||
if (print_peer_rate) out += "est.rec.rate ";
|
||||
out += "client \x1b[K\n";
|
||||
++pos;
|
||||
|
||||
|
@ -521,8 +521,7 @@ int print_peer_info(std::string& out
|
|||
{
|
||||
bool unchoked = (i->flags & peer_info::choked) == 0;
|
||||
|
||||
std::snprintf(str, sizeof(str), " %s %s"
|
||||
, add_suffix(i->remote_dl_rate, "/s").c_str()
|
||||
std::snprintf(str, sizeof(str), " %s"
|
||||
, unchoked ? add_suffix(i->estimated_reciprocation_rate, "/s").c_str() : " ");
|
||||
out += str;
|
||||
}
|
||||
|
|
|
@ -923,10 +923,6 @@ namespace libtorrent
|
|||
// http://blog.libtorrent.org/2011/11/block-request-time-outs/
|
||||
time_point m_requested = aux::time_now();
|
||||
|
||||
// a timestamp when the remote download rate
|
||||
// was last updated
|
||||
time_point m_remote_dl_update = aux::time_now();
|
||||
|
||||
// the time when async_connect was called
|
||||
// or when the incoming connection was established
|
||||
time_point m_connect = aux::time_now();
|
||||
|
@ -1066,14 +1062,6 @@ namespace libtorrent
|
|||
// another peer sends us a have message for this piece
|
||||
int m_superseed_piece[2] = {-1, -1};
|
||||
|
||||
// pieces downloaded since last second
|
||||
// timer timeout; used for determining
|
||||
// approx download rate
|
||||
int m_remote_pieces_dled = 0;
|
||||
|
||||
// approximate peer download rate
|
||||
int m_remote_dl_rate = 0;
|
||||
|
||||
// the number of bytes send to the disk-io
|
||||
// thread that hasn't yet been completely written.
|
||||
int m_outstanding_writing_bytes = 0;
|
||||
|
|
|
@ -312,9 +312,13 @@ namespace libtorrent
|
|||
// the kind of connection this peer uses. See connection_type_t.
|
||||
int connection_type;
|
||||
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
// an estimate of the rate this peer is downloading at, in
|
||||
// bytes per second.
|
||||
int remote_dl_rate;
|
||||
#else
|
||||
int deprecated_remote_dl_rate;
|
||||
#endif
|
||||
|
||||
// the number of bytes this peer has pending in the disk-io thread.
|
||||
// Downloaded and waiting to be written to disk. This is what is capped
|
||||
|
|
|
@ -1808,17 +1808,6 @@ namespace libtorrent
|
|||
|
||||
t->peer_has(index, this);
|
||||
|
||||
// this will disregard all have messages we get within
|
||||
// the first two seconds. Since some clients implements
|
||||
// lazy bitfields, these will not be reliable to use
|
||||
// for an estimated peer download rate.
|
||||
if (!peer_info_struct()
|
||||
|| m_ses.session_time() - peer_info_struct()->last_connected > 2)
|
||||
{
|
||||
// update bytes downloaded since last timer
|
||||
++m_remote_pieces_dled;
|
||||
}
|
||||
|
||||
// it's important to not disconnect before we have
|
||||
// updated the piece picker, otherwise we will incorrectly
|
||||
// decrement the piece count without first incrementing it
|
||||
|
@ -4381,7 +4370,9 @@ namespace libtorrent
|
|||
p.num_hashfails = 0;
|
||||
}
|
||||
|
||||
p.remote_dl_rate = m_remote_dl_rate;
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
p.remote_dl_rate = 0;
|
||||
#endif
|
||||
p.send_buffer_size = m_send_buffer.capacity();
|
||||
p.used_send_buffer = m_send_buffer.size();
|
||||
p.receive_buffer_size = m_recv_buffer.capacity();
|
||||
|
@ -4813,22 +4804,6 @@ namespace libtorrent
|
|||
snub_peer();
|
||||
}
|
||||
|
||||
// update once every minute
|
||||
if (now - m_remote_dl_update >= seconds(60))
|
||||
{
|
||||
std::int64_t piece_size = t->torrent_file().piece_length();
|
||||
|
||||
if (m_remote_dl_rate > 0)
|
||||
m_remote_dl_rate = int((m_remote_dl_rate * 2 / 3)
|
||||
+ ((std::int64_t(m_remote_pieces_dled) * piece_size / 3) / 60));
|
||||
else
|
||||
m_remote_dl_rate = int(std::int64_t(m_remote_pieces_dled)
|
||||
* piece_size / 60);
|
||||
|
||||
m_remote_pieces_dled = 0;
|
||||
m_remote_dl_update = now;
|
||||
}
|
||||
|
||||
fill_send_buffer();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue