added performance warning if there are too many optimistic unchoke slots

This commit is contained in:
Arvid Norberg 2010-02-06 07:39:45 +00:00
parent bb9426b97c
commit abfc92de35
4 changed files with 25 additions and 3 deletions

View File

@ -5625,7 +5625,8 @@ upload or download rate performance.
outstanding_request_limit_reached,
upload_limit_too_low,
download_limit_too_low,
send_buffer_watermark_too_low
send_buffer_watermark_too_low,
too_many_optimistic_unchoke_slots
};
performance_warning_t warning_code;

View File

@ -187,7 +187,14 @@ namespace libtorrent
outstanding_request_limit_reached,
upload_limit_too_low,
download_limit_too_low,
send_buffer_watermark_too_low
send_buffer_watermark_too_low,
too_many_optimistic_unchoke_slots
};
performance_alert(torrent_handle const& h

View File

@ -112,7 +112,8 @@ namespace libtorrent {
"max outstanding piece requests reached",
"upload limit too low (download rate will suffer)",
"download limit too low (upload rate will suffer)",
"send buffer watermark too low (upload rate will suffer)"
"send buffer watermark too low (upload rate will suffer)",
"too many optimistic unchoke slots"
};
return torrent_alert::message() + ": performance warning: "

View File

@ -1070,6 +1070,13 @@ namespace aux {
m_disk_thread.add_job(j);
}
if (m_allowed_upload_slots <= m_settings.num_optimistic_unchoke_slots / 2)
{
if (m_alerts.should_post<performance_alert>())
m_alerts.post_alert(performance_alert(torrent_handle()
, performance_alert::too_many_optimistic_unchoke_slots));
}
if (!s.auto_upload_slots) m_allowed_upload_slots = m_max_uploads;
// replace all occurances of '\n' with ' '.
std::string::iterator i = m_settings.user_agent.begin();
@ -3210,6 +3217,12 @@ namespace aux {
if (m_max_uploads == limit) return;
m_max_uploads = limit;
m_allowed_upload_slots = limit;
if (m_allowed_upload_slots <= m_settings.num_optimistic_unchoke_slots / 2)
{
if (m_alerts.should_post<performance_alert>())
m_alerts.post_alert(performance_alert(torrent_handle()
, performance_alert::too_many_optimistic_unchoke_slots));
}
}
void session_impl::set_max_connections(int limit)