From e4a943c74505cab5397cfe60b41aed460d7208b8 Mon Sep 17 00:00:00 2001 From: miguel Date: Sun, 18 Aug 2013 17:23:17 -0300 Subject: [PATCH] some crash fixes, disable ut_metadata, fix m_name --- libtorrent/include/libtorrent/storage.hpp | 7 ------- libtorrent/src/session.cpp | 2 +- libtorrent/src/torrent.cpp | 13 ++++++------- 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/libtorrent/include/libtorrent/storage.hpp b/libtorrent/include/libtorrent/storage.hpp index 4182fac7..c3310c9f 100644 --- a/libtorrent/include/libtorrent/storage.hpp +++ b/libtorrent/include/libtorrent/storage.hpp @@ -222,13 +222,6 @@ namespace libtorrent }; void delete_one_file(std::string const& p); - int readwritev(file::iovec_t const* bufs, int slot, int offset - , int num_bufs, fileop const&); - - size_type read_unaligned(boost::intrusive_ptr const& file_handle - , size_type file_offset, file::iovec_t const* bufs, int num_bufs, error_code& ec); - size_type write_unaligned(boost::intrusive_ptr const& file_handle - , size_type file_offset, file::iovec_t const* bufs, int num_bufs, error_code& ec); file_storage const& files() const { return m_mapped_files?*m_mapped_files:m_files; } diff --git a/libtorrent/src/session.cpp b/libtorrent/src/session.cpp index c934abe9..8e7102a4 100644 --- a/libtorrent/src/session.cpp +++ b/libtorrent/src/session.cpp @@ -433,7 +433,7 @@ namespace libtorrent if (flags & add_default_plugins) { add_extension(create_ut_pex_plugin); - add_extension(create_ut_metadata_plugin); + //add_extension(create_ut_metadata_plugin); add_extension(create_lt_trackers_plugin); add_extension(create_smart_ban_plugin); } diff --git a/libtorrent/src/torrent.cpp b/libtorrent/src/torrent.cpp index b8840589..da5ff342 100644 --- a/libtorrent/src/torrent.cpp +++ b/libtorrent/src/torrent.cpp @@ -432,7 +432,9 @@ namespace libtorrent , m_is_active_download(false) , m_is_active_finished(false) { - // if there is resume data already, we don't need to trigger the initial save + if (!p.name.empty()) m_name.reset(new std::string(p.name)); + + // if there is resume data already, we don't need to trigger the initial save // resume data if (!p.resume_data.empty() && (p.flags & add_torrent_params::flag_override_resume_data) == 0) m_need_save_resume_data = false; @@ -467,10 +469,6 @@ namespace libtorrent m_connections_initialized = true; m_block_size_shift = root2((std::min)(block_size, m_torrent_file->piece_length())); } - else - { - if (!p.name.empty()) m_name.reset(new std::string(p.name)); - } if (!m_url.empty() && m_uuid.empty()) m_uuid = m_url; @@ -2097,6 +2095,7 @@ namespace libtorrent { TORRENT_ASSERT(m_ses.is_network_thread()); if (!m_ses.m_dht) return; + if (!m_name) return; if (!should_announce_dht()) return; TORRENT_ASSERT(m_allow_peers); @@ -2110,7 +2109,7 @@ namespace libtorrent policy::peer const* p = *i; if( p->connectable && !p->banned ) { - m_ses.m_dht->announce(*m_name, m_torrent_file->info_hash() + m_ses.m_dht->announce(name(), m_torrent_file->info_hash() , p->address(), p->port, p->seed, false , boost::bind(&nop)); } @@ -2124,7 +2123,7 @@ namespace libtorrent #endif boost::weak_ptr self(shared_from_this()); - m_ses.m_dht->announce(*m_name, m_torrent_file->info_hash() + m_ses.m_dht->announce(name(), m_torrent_file->info_hash() , m_ses.external_address().external_address(address_v4()), port, is_seed(), true , boost::bind(&torrent::on_dht_announce_response_disp, self, _1)); }