From 2741563711e5975638ed613f1407e1358ae737e7 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Sat, 8 Oct 2011 09:52:36 +0000 Subject: [PATCH] set alert_mask early --- include/libtorrent/alert.hpp | 3 ++- include/libtorrent/aux_/session_impl.hpp | 1 + src/alert.cpp | 4 ++-- src/session.cpp | 3 +-- src/session_impl.cpp | 3 ++- test/test_primitives.cpp | 4 ++-- 6 files changed, 10 insertions(+), 8 deletions(-) diff --git a/include/libtorrent/alert.hpp b/include/libtorrent/alert.hpp index 0579f5183..e8b4e2730 100644 --- a/include/libtorrent/alert.hpp +++ b/include/libtorrent/alert.hpp @@ -128,7 +128,8 @@ namespace libtorrent { class TORRENT_EXPORT alert_manager { public: - alert_manager(io_service& ios, int queue_limit); + alert_manager(io_service& ios, int queue_limit + , boost::uint32_t alert_mask = alert::error_notification); ~alert_manager(); void post_alert(const alert& alert_); diff --git a/include/libtorrent/aux_/session_impl.hpp b/include/libtorrent/aux_/session_impl.hpp index 8aa6ca9d1..956f6404b 100644 --- a/include/libtorrent/aux_/session_impl.hpp +++ b/include/libtorrent/aux_/session_impl.hpp @@ -191,6 +191,7 @@ namespace libtorrent std::pair listen_port_range , fingerprint const& cl_fprint , char const* listen_interface + , boost::uint32_t alert_mask #if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING || defined TORRENT_ERROR_LOGGING , std::string const& logpath #endif diff --git a/src/alert.cpp b/src/alert.cpp index 9efa13533..2e6984c83 100644 --- a/src/alert.cpp +++ b/src/alert.cpp @@ -331,8 +331,8 @@ namespace libtorrent { - alert_manager::alert_manager(io_service& ios, int queue_limit) - : m_alert_mask(alert::error_notification) + alert_manager::alert_manager(io_service& ios, int queue_limit, boost::uint32_t alert_mask) + : m_alert_mask(alert_mask) , m_queue_size_limit(queue_limit) , m_ios(ios) {} diff --git a/src/session.cpp b/src/session.cpp index 1871fb775..a54309ec2 100644 --- a/src/session.cpp +++ b/src/session.cpp @@ -381,12 +381,11 @@ namespace libtorrent void session::init(std::pair listen_range, char const* listen_interface , fingerprint const& id, int flags, boost::uint32_t alert_mask TORRENT_LOGPATH_ARG) { - m_impl.reset(new session_impl(listen_range, id, listen_interface TORRENT_LOGPATH)); + m_impl.reset(new session_impl(listen_range, id, listen_interface, alert_mask TORRENT_LOGPATH)); #ifdef TORRENT_MEMDEBUG start_malloc_debug(); #endif - set_alert_mask(alert_mask); #ifndef TORRENT_DISABLE_EXTENSIONS if (flags & add_default_plugins) { diff --git a/src/session_impl.cpp b/src/session_impl.cpp index 26e938acf..9602d84f1 100644 --- a/src/session_impl.cpp +++ b/src/session_impl.cpp @@ -466,6 +466,7 @@ namespace aux { std::pair listen_port_range , fingerprint const& cl_fprint , char const* listen_interface + , boost::uint32_t alert_mask #if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING || defined TORRENT_ERROR_LOGGING , std::string const& logpath #endif @@ -482,7 +483,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_settings.alert_queue_size) + , m_alerts(m_io_service, m_settings.alert_queue_size, alert_mask) , 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) diff --git a/test/test_primitives.cpp b/test/test_primitives.cpp index 83df39bec..c91ac52a1 100644 --- a/test/test_primitives.cpp +++ b/test/test_primitives.cpp @@ -501,7 +501,7 @@ int test_main() // test external ip voting aux::session_impl* ses = new aux::session_impl(std::pair(0,0) - , fingerprint("LT", 0, 0, 0, 0), "0.0.0.0" + , fingerprint("LT", 0, 0, 0, 0), "0.0.0.0", 0 #if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING || defined TORRENT_ERROR_LOGGING , "" #endif @@ -524,7 +524,7 @@ int test_main() #endif delete ses; ses = new aux::session_impl(std::pair(0,0) - , fingerprint("LT", 0, 0, 0, 0), "0.0.0.0" + , fingerprint("LT", 0, 0, 0, 0), "0.0.0.0", 0 #if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING || defined TORRENT_ERROR_LOGGING , "" #endif