diff --git a/CMakeLists.txt b/CMakeLists.txt index 9c5559467..0af5b9314 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,6 +4,7 @@ project(libtorrent) set(sources web_connection_base alert + alert_manager allocator asio asio_ssl diff --git a/Jamfile b/Jamfile index 87fa7c68d..7fc8433e5 100755 --- a/Jamfile +++ b/Jamfile @@ -331,6 +331,9 @@ feature.compose xp : _WIN32_WINNT=0x0501 ; feature.compose vista : _WIN32_WINNT=0x0600 ; feature.compose win7 : _WIN32_WINNT=0x0601 ; +feature extensions : on off : composite propagated link-incompatible ; +feature.compose off : TORRENT_DISABLE_EXTENSION ; + feature asio-debugging : off on : composite propagated link-incompatible ; feature.compose on : TORRENT_ASIO_DEBUGGING ; @@ -463,6 +466,7 @@ lib iphlpapi : : iphlpapi shared ; SOURCES = alert + alert_manager allocator asio assert diff --git a/include/libtorrent/Makefile.am b/include/libtorrent/Makefile.am index efb9e604f..0ab324841 100644 --- a/include/libtorrent/Makefile.am +++ b/include/libtorrent/Makefile.am @@ -8,6 +8,7 @@ nobase_include_HEADERS = \ address.hpp \ add_torrent_params.hpp \ alert.hpp \ + alert_manager.hpp \ alert_dispatcher.hpp \ alert_types.hpp \ alloca.hpp \ diff --git a/include/libtorrent/alert.hpp b/include/libtorrent/alert.hpp index 8347c9e99..322efebbd 100644 --- a/include/libtorrent/alert.hpp +++ b/include/libtorrent/alert.hpp @@ -1,6 +1,6 @@ /* -Copyright (c) 2003-2012, Arvid Norberg, Daniel Wallin +Copyright (c) 2003-2013, Arvid Norberg, Daniel Wallin All rights reserved. Redistribution and use in source and binary forms, with or without @@ -41,28 +41,18 @@ POSSIBILITY OF SUCH DAMAGE. #pragma warning(push, 1) #endif -#include - #include #include #include #include #include -#ifndef TORRENT_DISABLE_EXTENSIONS -#include -#include -#endif - #ifdef _MSC_VER #pragma warning(pop) #endif #include "libtorrent/ptime.hpp" #include "libtorrent/config.hpp" -#include "libtorrent/assert.hpp" -#include "libtorrent/thread.hpp" -#include "libtorrent/io_service_fwd.hpp" #ifndef TORRENT_MAX_ALERT_TYPES #define TORRENT_MAX_ALERT_TYPES 15 @@ -70,10 +60,6 @@ POSSIBILITY OF SUCH DAMAGE. namespace libtorrent { -#ifndef TORRENT_DISABLE_EXTENSIONS - struct plugin; -#endif - class TORRENT_EXPORT alert { public: @@ -129,68 +115,6 @@ namespace libtorrent { ptime m_timestamp; }; - class TORRENT_EXTRA_EXPORT alert_manager - { - public: - alert_manager(io_service& ios, int queue_limit - , boost::uint32_t alert_mask = alert::error_notification); - ~alert_manager(); - - void post_alert(const alert& alert_); - void post_alert_ptr(alert* alert_); - bool pending() const; - std::auto_ptr get(); - void get_all(std::deque* alerts); - - template - bool should_post() const - { - mutex::scoped_lock lock(m_mutex); - if (m_alerts.size() >= m_queue_size_limit) return false; - return (m_alert_mask & T::static_category) != 0; - } - - bool should_post(alert const* a) const - { - return m_alert_mask & a->category(); - } - - alert const* wait_for_alert(time_duration max_wait); - - void set_alert_mask(boost::uint32_t m) - { - mutex::scoped_lock lock(m_mutex); - m_alert_mask = m; - } - - int alert_mask() const { return m_alert_mask; } - - size_t alert_queue_size_limit() const { return m_queue_size_limit; } - size_t set_alert_queue_size_limit(size_t queue_size_limit_); - - void set_dispatch_function(boost::function)> const&); - -#ifndef TORRENT_DISABLE_EXTENSIONS - void add_extension(boost::shared_ptr ext); -#endif - - private: - void post_impl(std::auto_ptr& alert_, mutex::scoped_lock& l); - - std::deque m_alerts; - mutable mutex m_mutex; - condition_variable m_condition; - boost::uint32_t m_alert_mask; - size_t m_queue_size_limit; - boost::function)> m_dispatch; - io_service& m_ios; - -#ifndef TORRENT_DISABLE_EXTENSIONS - typedef std::list > ses_extension_list_t; - ses_extension_list_t m_ses_extensions; -#endif - }; - struct TORRENT_EXPORT unhandled_alert : std::exception { unhandled_alert() {} diff --git a/include/libtorrent/alert_manager.hpp b/include/libtorrent/alert_manager.hpp new file mode 100644 index 000000000..06fd2ec74 --- /dev/null +++ b/include/libtorrent/alert_manager.hpp @@ -0,0 +1,116 @@ +/* + +Copyright (c) 2003-2013, Arvid Norberg, Daniel Wallin +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the distribution. + * Neither the name of the author nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + +*/ + +#ifndef TORRENT_ALERT_MANAGER_HPP_INCLUDED +#define TORRENT_ALERT_MANAGER_HPP_INCLUDED + +#include "libtorrent/config.hpp" +#include "libtorrent/alert.hpp" +#include "libtorrent/io_service_fwd.hpp" +#include "libtorrent/thread.hpp" + +#include +#include +#include + +namespace libtorrent { + +#ifndef TORRENT_DISABLE_EXTENSIONS + struct plugin; +#endif + + class TORRENT_EXTRA_EXPORT alert_manager + { + public: + alert_manager(io_service& ios, int queue_limit + , boost::uint32_t alert_mask = alert::error_notification); + ~alert_manager(); + + void post_alert(const alert& alert_); + void post_alert_ptr(alert* alert_); + bool pending() const; + std::auto_ptr get(); + void get_all(std::deque* alerts); + + template + bool should_post() const + { + mutex::scoped_lock lock(m_mutex); + if (m_alerts.size() >= m_queue_size_limit) return false; + return (m_alert_mask & T::static_category) != 0; + } + + bool should_post(alert const* a) const + { + return m_alert_mask & a->category(); + } + + alert const* wait_for_alert(time_duration max_wait); + + void set_alert_mask(boost::uint32_t m) + { + mutex::scoped_lock lock(m_mutex); + m_alert_mask = m; + } + + int alert_mask() const { return m_alert_mask; } + + size_t alert_queue_size_limit() const { return m_queue_size_limit; } + size_t set_alert_queue_size_limit(size_t queue_size_limit_); + + void set_dispatch_function(boost::function)> const&); + +#ifndef TORRENT_DISABLE_EXTENSIONS + void add_extension(boost::shared_ptr ext); +#endif + + private: + void post_impl(std::auto_ptr& alert_, mutex::scoped_lock& l); + + std::deque m_alerts; + mutable mutex m_mutex; + condition_variable m_condition; + boost::uint32_t m_alert_mask; + size_t m_queue_size_limit; + boost::function)> m_dispatch; + io_service& m_ios; + +#ifndef TORRENT_DISABLE_EXTENSIONS + typedef std::list > ses_extension_list_t; + ses_extension_list_t m_ses_extensions; +#endif + }; + +} + +#endif + diff --git a/include/libtorrent/aux_/session_impl.hpp b/include/libtorrent/aux_/session_impl.hpp index 127aacd50..e3284d8f8 100644 --- a/include/libtorrent/aux_/session_impl.hpp +++ b/include/libtorrent/aux_/session_impl.hpp @@ -80,7 +80,7 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/assert.hpp" #include "libtorrent/thread.hpp" #include "libtorrent/policy.hpp" // for policy::peer -#include "libtorrent/alert.hpp" // for alert_manager +#include "libtorrent/alert_manager.hpp" // for alert_manager #include "libtorrent/deadline_timer.hpp" #include "libtorrent/socket_io.hpp" // for print_address #include "libtorrent/address.hpp" diff --git a/include/libtorrent/build_config.hpp b/include/libtorrent/build_config.hpp index 00483f088..f4159fb7a 100644 --- a/include/libtorrent/build_config.hpp +++ b/include/libtorrent/build_config.hpp @@ -81,18 +81,11 @@ POSSIBILITY OF SUCH DAMAGE. #define TORRENT_CFG_STATS fullstats_ #endif -#ifdef TORRENT_DISABLE_EXTENSIONS -#define TORRENT_CFG_EXT noext_ -#else -#define TORRENT_CFG_EXT ext_ -#endif - #define TORRENT_CFG \ BOOST_PP_CAT(TORRENT_CFG_DEBUG, \ BOOST_PP_CAT(TORRENT_CFG_TIME, \ BOOST_PP_CAT(TORRENT_CFG_LOG, \ - BOOST_PP_CAT(TORRENT_CFG_DEPR, \ - TORRENT_CFG_EXT)))) + TORRENT_CFG_DEPR))) #define TORRENT_CFG_STRING BOOST_PP_STRINGIZE(TORRENT_CFG) diff --git a/include/libtorrent/peer_connection.hpp b/include/libtorrent/peer_connection.hpp index 00304a71c..a8c56c616 100644 --- a/include/libtorrent/peer_connection.hpp +++ b/include/libtorrent/peer_connection.hpp @@ -79,6 +79,7 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/socket_type_fwd.hpp" #include "libtorrent/error_code.hpp" #include "libtorrent/sliding_average.hpp" +#include "libtorrent/io_service_fwd.hpp" #ifdef TORRENT_STATS #include "libtorrent/aux_/session_impl.hpp" diff --git a/include/libtorrent/session.hpp b/include/libtorrent/session.hpp index f4f9a9f01..3fdd3760b 100644 --- a/include/libtorrent/session.hpp +++ b/include/libtorrent/session.hpp @@ -284,10 +284,8 @@ namespace libtorrent pe_settings get_pe_settings() const; #endif -#ifndef TORRENT_DISABLE_EXTENSIONS void add_extension(boost::function(torrent*, void*)> ext); void add_extension(boost::shared_ptr ext); -#endif #ifndef TORRENT_DISABLE_GEO_IP int as_for_ip(address const& addr); diff --git a/include/libtorrent/torrent_handle.hpp b/include/libtorrent/torrent_handle.hpp index 5d29cf502..17d558f18 100644 --- a/include/libtorrent/torrent_handle.hpp +++ b/include/libtorrent/torrent_handle.hpp @@ -223,10 +223,8 @@ namespace libtorrent void remove_http_seed(std::string const& url) const; std::set http_seeds() const; -#ifndef TORRENT_DISABLE_EXTENSIONS void add_extension(boost::function(torrent*, void*)> const& ext , void* userdata = 0); -#endif bool set_metadata(char const* metadata, int size) const; diff --git a/src/Makefile.am b/src/Makefile.am index 6d618c3be..1a1716caa 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -23,6 +23,7 @@ endif libtorrent_rasterbar_la_SOURCES = \ web_connection_base.cpp \ alert.cpp \ + alert_manager.cpp \ allocator.cpp \ asio.cpp \ assert.cpp \ diff --git a/src/alert.cpp b/src/alert.cpp index 507b8a770..8c22f5047 100644 --- a/src/alert.cpp +++ b/src/alert.cpp @@ -340,160 +340,6 @@ namespace libtorrent { return msg; } - - - 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) - {} - - alert_manager::~alert_manager() - { - while (!m_alerts.empty()) - { - TORRENT_ASSERT(alert_cast(m_alerts.front()) == 0 - && "shutting down session with remaining resume data alerts in the alert queue. " - "You proabably wany to make sure you always wait for all resume data " - "alerts before shutting down"); - delete m_alerts.front(); - m_alerts.pop_front(); - } - } - - alert const* alert_manager::wait_for_alert(time_duration max_wait) - { - mutex::scoped_lock lock(m_mutex); - - if (!m_alerts.empty()) return m_alerts.front(); - - // this call can be interrupted prematurely by other signals - m_condition.wait_for(lock, max_wait); - if (!m_alerts.empty()) return m_alerts.front(); - - return NULL; - } - - void alert_manager::set_dispatch_function(boost::function)> const& fun) - { - mutex::scoped_lock lock(m_mutex); - - m_dispatch = fun; - - std::deque alerts; - m_alerts.swap(alerts); - lock.unlock(); - - while (!alerts.empty()) - { - TORRENT_TRY { - m_dispatch(std::auto_ptr(alerts.front())); - } TORRENT_CATCH(std::exception&) {} - alerts.pop_front(); - } - } - - void dispatch_alert(boost::function dispatcher - , alert* alert_) - { - std::auto_ptr holder(alert_); - dispatcher(*alert_); - } - - void alert_manager::post_alert_ptr(alert* alert_) - { - std::auto_ptr a(alert_); - -#ifndef TORRENT_DISABLE_EXTENSIONS - for (ses_extension_list_t::iterator i = m_ses_extensions.begin() - , end(m_ses_extensions.end()); i != end; ++i) - { - TORRENT_TRY { - (*i)->on_alert(alert_); - } TORRENT_CATCH(std::exception&) {} - } -#endif - - mutex::scoped_lock lock(m_mutex); - post_impl(a, lock); - } - - void alert_manager::post_alert(const alert& alert_) - { - std::auto_ptr a(alert_.clone()); - -#ifndef TORRENT_DISABLE_EXTENSIONS - for (ses_extension_list_t::iterator i = m_ses_extensions.begin() - , end(m_ses_extensions.end()); i != end; ++i) - { - TORRENT_TRY { - (*i)->on_alert(&alert_); - } TORRENT_CATCH(std::exception&) {} - } -#endif - - mutex::scoped_lock lock(m_mutex); - post_impl(a, lock); - } - - void alert_manager::post_impl(std::auto_ptr& alert_, mutex::scoped_lock& l) - { - if (m_dispatch) - { - TORRENT_ASSERT(m_alerts.empty()); - TORRENT_TRY { - m_dispatch(alert_); - } TORRENT_CATCH(std::exception&) {} - } - else if (m_alerts.size() < m_queue_size_limit || !alert_->discardable()) - { - m_alerts.push_back(alert_.release()); - if (m_alerts.size() == 1) - m_condition.notify_all(); - } - } - -#ifndef TORRENT_DISABLE_EXTENSIONS - void alert_manager::add_extension(boost::shared_ptr ext) - { - m_ses_extensions.push_back(ext); - } -#endif - - std::auto_ptr alert_manager::get() - { - mutex::scoped_lock lock(m_mutex); - - if (m_alerts.empty()) - return std::auto_ptr(0); - - alert* result = m_alerts.front(); - m_alerts.pop_front(); - return std::auto_ptr(result); - } - - void alert_manager::get_all(std::deque* alerts) - { - mutex::scoped_lock lock(m_mutex); - if (m_alerts.empty()) return; - m_alerts.swap(*alerts); - } - - bool alert_manager::pending() const - { - mutex::scoped_lock lock(m_mutex); - - return !m_alerts.empty(); - } - - size_t alert_manager::set_alert_queue_size_limit(size_t queue_size_limit_) - { - mutex::scoped_lock lock(m_mutex); - - std::swap(m_queue_size_limit, queue_size_limit_); - return queue_size_limit_; - } - stats_alert::stats_alert(torrent_handle const& h, int in , stat const& s) : torrent_alert(h) diff --git a/src/alert_manager.cpp b/src/alert_manager.cpp new file mode 100644 index 000000000..5255f3a90 --- /dev/null +++ b/src/alert_manager.cpp @@ -0,0 +1,197 @@ +/* + +Copyright (c) 2003-2013, Arvid Norberg, Daniel Wallin +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the distribution. + * Neither the name of the author nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + +*/ + +#include "libtorrent/config.hpp" +#include "libtorrent/alert_manager.hpp" +#include "libtorrent/alert_types.hpp" + +#ifndef TORRENT_DISABLE_EXTENSIONS +#include "libtorrent/extensions.hpp" +#endif + +namespace libtorrent +{ + + 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) + {} + + alert_manager::~alert_manager() + { + while (!m_alerts.empty()) + { + TORRENT_ASSERT(alert_cast(m_alerts.front()) == 0 + && "shutting down session with remaining resume data alerts in the alert queue. " + "You proabably wany to make sure you always wait for all resume data " + "alerts before shutting down"); + delete m_alerts.front(); + m_alerts.pop_front(); + } + } + + alert const* alert_manager::wait_for_alert(time_duration max_wait) + { + mutex::scoped_lock lock(m_mutex); + + if (!m_alerts.empty()) return m_alerts.front(); + + // this call can be interrupted prematurely by other signals + m_condition.wait_for(lock, max_wait); + if (!m_alerts.empty()) return m_alerts.front(); + + return NULL; + } + + void alert_manager::set_dispatch_function(boost::function)> const& fun) + { + mutex::scoped_lock lock(m_mutex); + + m_dispatch = fun; + + std::deque alerts; + m_alerts.swap(alerts); + lock.unlock(); + + while (!alerts.empty()) + { + TORRENT_TRY { + m_dispatch(std::auto_ptr(alerts.front())); + } TORRENT_CATCH(std::exception&) {} + alerts.pop_front(); + } + } + + void dispatch_alert(boost::function dispatcher + , alert* alert_) + { + std::auto_ptr holder(alert_); + dispatcher(*alert_); + } + + void alert_manager::post_alert_ptr(alert* alert_) + { + std::auto_ptr a(alert_); + +#ifndef TORRENT_DISABLE_EXTENSIONS + for (ses_extension_list_t::iterator i = m_ses_extensions.begin() + , end(m_ses_extensions.end()); i != end; ++i) + { + TORRENT_TRY { + (*i)->on_alert(alert_); + } TORRENT_CATCH(std::exception&) {} + } +#endif + + mutex::scoped_lock lock(m_mutex); + post_impl(a, lock); + } + + void alert_manager::post_alert(const alert& alert_) + { + std::auto_ptr a(alert_.clone()); + +#ifndef TORRENT_DISABLE_EXTENSIONS + for (ses_extension_list_t::iterator i = m_ses_extensions.begin() + , end(m_ses_extensions.end()); i != end; ++i) + { + TORRENT_TRY { + (*i)->on_alert(&alert_); + } TORRENT_CATCH(std::exception&) {} + } +#endif + + mutex::scoped_lock lock(m_mutex); + post_impl(a, lock); + } + + void alert_manager::post_impl(std::auto_ptr& alert_, mutex::scoped_lock& l) + { + if (m_dispatch) + { + TORRENT_ASSERT(m_alerts.empty()); + TORRENT_TRY { + m_dispatch(alert_); + } TORRENT_CATCH(std::exception&) {} + } + else if (m_alerts.size() < m_queue_size_limit || !alert_->discardable()) + { + m_alerts.push_back(alert_.release()); + if (m_alerts.size() == 1) + m_condition.notify_all(); + } + } + +#ifndef TORRENT_DISABLE_EXTENSIONS + void alert_manager::add_extension(boost::shared_ptr ext) + { + m_ses_extensions.push_back(ext); + } +#endif + + std::auto_ptr alert_manager::get() + { + mutex::scoped_lock lock(m_mutex); + + if (m_alerts.empty()) + return std::auto_ptr(0); + + alert* result = m_alerts.front(); + m_alerts.pop_front(); + return std::auto_ptr(result); + } + + void alert_manager::get_all(std::deque* alerts) + { + mutex::scoped_lock lock(m_mutex); + if (m_alerts.empty()) return; + m_alerts.swap(*alerts); + } + + bool alert_manager::pending() const + { + mutex::scoped_lock lock(m_mutex); + + return !m_alerts.empty(); + } + + size_t alert_manager::set_alert_queue_size_limit(size_t queue_size_limit_) + { + mutex::scoped_lock lock(m_mutex); + + std::swap(m_queue_size_limit, queue_size_limit_); + return queue_size_limit_; + } + +} + diff --git a/src/session.cpp b/src/session.cpp index 99dbe5fe7..a0a24d588 100644 --- a/src/session.cpp +++ b/src/session.cpp @@ -489,17 +489,19 @@ namespace libtorrent TORRENT_SYNC_CALL1(get_feeds, &f); } -#ifndef TORRENT_DISABLE_EXTENSIONS void session::add_extension(boost::function(torrent*, void*)> ext) { +#ifndef TORRENT_DISABLE_EXTENSIONS TORRENT_ASYNC_CALL1(add_extension, ext); +#endif } void session::add_extension(boost::shared_ptr ext) { +#ifndef TORRENT_DISABLE_EXTENSIONS TORRENT_ASYNC_CALL1(add_ses_extension, ext); - } #endif + } #ifndef TORRENT_DISABLE_GEO_IP void session::load_asnum_db(char const* file) diff --git a/src/torrent_handle.cpp b/src/torrent_handle.cpp index 783151c83..5b3dd586b 100644 --- a/src/torrent_handle.cpp +++ b/src/torrent_handle.cpp @@ -369,15 +369,15 @@ namespace libtorrent TORRENT_ASYNC_CALL2(rename_file, index, new_name); } -#ifndef TORRENT_DISABLE_EXTENSIONS void torrent_handle::add_extension( boost::function(torrent*, void*)> const& ext , void* userdata) { +#ifndef TORRENT_DISABLE_EXTENSIONS INVARIANT_CHECK; TORRENT_ASYNC_CALL2(add_extension, ext, userdata); - } #endif + } bool torrent_handle::set_metadata(char const* metadata, int size) const {