fixed alert queue size limit bug when restoring setting from session state

This commit is contained in:
Arvid Norberg 2011-03-07 00:36:51 +00:00
parent c0bbac579a
commit f90f9f6609
4 changed files with 8 additions and 10 deletions

View File

@ -128,9 +128,7 @@ namespace libtorrent {
class TORRENT_EXPORT alert_manager
{
public:
enum { queue_size_limit_default = 1000 };
alert_manager(io_service& ios);
alert_manager(io_service& ios, int queue_limit);
~alert_manager();
void post_alert(const alert& alert_);

View File

@ -455,6 +455,9 @@ namespace libtorrent
void on_lsd_peer(tcp::endpoint peer, sha1_hash const& ih);
void setup_socket_buffers(socket_type& s);
// the settings for the client
session_settings m_settings;
// this is a shared pool where policy_peer objects
// are allocated. It's a pool since we're likely
// to have tens of thousands of peers, and a pool
@ -670,9 +673,6 @@ namespace libtorrent
listen_socket_t setup_listener(tcp::endpoint ep, int retries
, bool v6_only, int flags, error_code& ec);
// the settings for the client
session_settings m_settings;
// the proxy used for bittorrent
proxy_settings m_proxy;

View File

@ -328,9 +328,9 @@ namespace libtorrent {
alert_manager::alert_manager(io_service& ios)
alert_manager::alert_manager(io_service& ios, int queue_limit)
: m_alert_mask(alert::error_notification)
, m_queue_size_limit(queue_size_limit_default)
, m_queue_size_limit(queue_limit)
, m_ios(ios)
{}

View File

@ -478,7 +478,7 @@ namespace aux {
#ifdef TORRENT_USE_OPENSSL
, m_ssl_ctx(m_io_service, asio::ssl::context::sslv23_client)
#endif
, m_alerts(m_io_service)
, m_alerts(m_io_service, m_settings.alert_queue_size)
, m_disk_thread(m_io_service, boost::bind(&session_impl::on_disk_queue, this), m_files)
, m_half_open(m_io_service)
, m_download_rate(peer_connection::download_channel)
@ -1078,9 +1078,9 @@ namespace aux {
}
update_rate_settings();
update_connections_limit();
update_unchoke_limit();
m_alerts.set_alert_queue_size_limit(m_settings.alert_queue_size);
// in case we just set a socks proxy, we might have to
// open the socks incoming connection