diff --git a/libtorrent/include/libtorrent/create_torrent.hpp b/libtorrent/include/libtorrent/create_torrent.hpp index 108de8fda..a521a1b3e 100644 --- a/libtorrent/include/libtorrent/create_torrent.hpp +++ b/libtorrent/include/libtorrent/create_torrent.hpp @@ -155,9 +155,9 @@ namespace libtorrent { for (directory_iterator i(f), end; i != end; ++i) #if BOOST_VERSION < 103600 - add_files_impl(fs, p, l / i->leaf(), pred); + add_files_impl(fs, p, l / i->path().leaf(), pred); #else - add_files_impl(fs, p, l / i->filename(), pred); + add_files_impl(fs, p, l / i->path().filename(), pred); #endif } else @@ -179,7 +179,11 @@ namespace libtorrent inline void add_files(file_storage& fs, boost::filesystem::path const& file) { +#if BOOST_VERSION < 103600 detail::add_files_impl(fs, complete(file).branch_path(), file.leaf(), detail::default_pred); +#else + detail::add_files_impl(fs, complete(file).parent_path(), file.filename(), detail::default_pred); +#endif } template diff --git a/libtorrent/include/libtorrent/session_settings.hpp b/libtorrent/include/libtorrent/session_settings.hpp index d7ec48591..dbfa9be5c 100644 --- a/libtorrent/include/libtorrent/session_settings.hpp +++ b/libtorrent/include/libtorrent/session_settings.hpp @@ -143,6 +143,7 @@ namespace libtorrent , min_announce_interval(5 * 60) , prioritize_partial_pieces(false) , auto_manage_startup(120) + , rate_limit_ip_overhead(true) {} // this is the user agent that will be sent to the tracker @@ -450,6 +451,11 @@ namespace libtorrent // inactive until they have a fair chance to // start downloading. int auto_manage_startup; + + // if set to true, the estimated TCP/IP overhead is + // drained from the rate limiters, to avoid exceeding + // the limits with the total traffic + bool rate_limit_ip_overhead; }; #ifndef TORRENT_DISABLE_DHT diff --git a/libtorrent/include/libtorrent/version.hpp b/libtorrent/include/libtorrent/version.hpp index 06b1bbe13..8a02b90ec 100644 --- a/libtorrent/include/libtorrent/version.hpp +++ b/libtorrent/include/libtorrent/version.hpp @@ -36,6 +36,6 @@ POSSIBILITY OF SUCH DAMAGE. #define LIBTORRENT_VERSION_MAJOR 0 #define LIBTORRENT_VERSION_MINOR 14 -#define LIBTORRENT_VERSION "0.14.0.0" +#define LIBTORRENT_VERSION "0.14.1.0" #endif diff --git a/libtorrent/src/bt_peer_connection.cpp b/libtorrent/src/bt_peer_connection.cpp index 3e682ee92..5a21cd250 100755 --- a/libtorrent/src/bt_peer_connection.cpp +++ b/libtorrent/src/bt_peer_connection.cpp @@ -1010,7 +1010,7 @@ namespace libtorrent if (!allocate_disk_receive_buffer(packet_size() - 9)) return; } - TORRENT_ASSERT(has_disk_receive_buffer()); + TORRENT_ASSERT(has_disk_receive_buffer() || packet_size() == 9); // classify the received data as protocol chatter // or data payload for the statistics diff --git a/libtorrent/src/file.cpp b/libtorrent/src/file.cpp index bd3a0d368..ebcc2cf97 100755 --- a/libtorrent/src/file.cpp +++ b/libtorrent/src/file.cpp @@ -171,9 +171,9 @@ namespace libtorrent #ifdef TORRENT_WINDOWS #ifdef UNICODE - std::wstring file_path(safe_convert(path.native_file_string())); + std::wstring file_path(safe_convert(path.external_file_string())); #else - std::string file_path = utf8_native(path.native_file_string()); + std::string file_path = utf8_native(path.external_file_string()); #endif m_file_handle = CreateFile( @@ -205,7 +205,7 @@ namespace libtorrent | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH; - m_fd = ::open(path.native_file_string().c_str() + m_fd = ::open(path.external_file_string().c_str() , map_open_mode(mode.m_mask), permissions); if (m_fd == -1) diff --git a/libtorrent/src/peer_connection.cpp b/libtorrent/src/peer_connection.cpp index dc5116df2..a2848281d 100755 --- a/libtorrent/src/peer_connection.cpp +++ b/libtorrent/src/peer_connection.cpp @@ -1665,7 +1665,7 @@ namespace libtorrent if (t->alerts().should_post()) { t->alerts().post_alert(peer_error_alert(t->get_handle(), m_remote - , m_peer_id, "peer sent 0 length piece")); + , m_peer_id, "peer sent 0 length piece")); } return; } diff --git a/libtorrent/src/session_impl.cpp b/libtorrent/src/session_impl.cpp index 561b0506e..412330db0 100755 --- a/libtorrent/src/session_impl.cpp +++ b/libtorrent/src/session_impl.cpp @@ -1107,9 +1107,12 @@ namespace aux { ++i; } - // drain the IP overhead from the bandwidth limiters - m_download_channel.drain(m_stat.download_ip_overhead()); - m_upload_channel.drain(m_stat.upload_ip_overhead()); + if (m_settings.rate_limit_ip_overhead) + { + // drain the IP overhead from the bandwidth limiters + m_download_channel.drain(m_stat.download_ip_overhead()); + m_upload_channel.drain(m_stat.upload_ip_overhead()); + } m_stat.second_tick(tick_interval); diff --git a/libtorrent/src/storage.cpp b/libtorrent/src/storage.cpp index 376da677a..91fd47f21 100755 --- a/libtorrent/src/storage.cpp +++ b/libtorrent/src/storage.cpp @@ -159,7 +159,7 @@ namespace // First create branch, by calling ourself recursively create_directories_win(ph.branch_path()); // Now that parent's path exists, create the directory - std::wstring wph(safe_convert(ph.native_directory_string())); + std::wstring wph(safe_convert(ph.external_directory_string())); CreateDirectory(wph.c_str(), 0); return true; } @@ -207,7 +207,7 @@ namespace std::time_t last_write_time_win( const fs::path & ph ) { struct _stat path_stat; - std::wstring wph(safe_convert(ph.native_file_string())); + std::wstring wph(safe_convert(ph.external_file_string())); if ( ::_wstat( wph.c_str(), &path_stat ) != 0 ) boost::throw_exception( filesystem_error( "boost::filesystem::last_write_time", @@ -272,9 +272,9 @@ namespace libtorrent for (basic_directory_iterator i(old_path), end; i != end; ++i) { #if BOOST_VERSION < 103600 - recursive_copy(i->path(), new_path / i->leaf(), ec); + recursive_copy(i->path(), new_path / i->path().leaf(), ec); #else - recursive_copy(i->path(), new_path / i->filename(), ec); + recursive_copy(i->path(), new_path / i->path().filename(), ec); #endif if (ec) return; } @@ -390,7 +390,7 @@ namespace libtorrent || (!compact_mode && size < s->first)) { if (error) *error = "filesize mismatch for file '" - + i->path.native_file_string() + + i->path.external_file_string() + "', size: " + boost::lexical_cast(size) + ", expected to be " + boost::lexical_cast(s->first) + " bytes"; @@ -403,7 +403,7 @@ namespace libtorrent (!compact_mode && (time > s->second + 5 * 60) || time < s->second - 1)) { if (error) *error = "timestamp mismatch for file '" - + i->path.native_file_string() + + i->path.external_file_string() + "', modification date: " + boost::lexical_cast(time) + ", expected to have modification date " + boost::lexical_cast(s->second); @@ -821,7 +821,7 @@ namespace libtorrent { if (i->size != fs->first) { - error = "file size for '" + i->path.native_file_string() + error = "file size for '" + i->path.external_file_string() + "' was expected to be " + boost::lexical_cast(i->size) + " bytes"; return false; @@ -847,7 +847,7 @@ namespace libtorrent save_path = complete(save_path); #if defined(_WIN32) && defined(UNICODE) && BOOST_VERSION < 103400 - std::wstring wsave_path(safe_convert(save_path.native_file_string())); + std::wstring wsave_path(safe_convert(save_path.external_file_string())); if (!exists_win(save_path)) CreateDirectory(wsave_path.c_str(), 0); else if ((GetFileAttributes(wsave_path.c_str()) & FILE_ATTRIBUTE_DIRECTORY) == 0) diff --git a/libtorrent/src/torrent.cpp b/libtorrent/src/torrent.cpp index 0f2036586..bc0dbcf68 100755 --- a/libtorrent/src/torrent.cpp +++ b/libtorrent/src/torrent.cpp @@ -750,7 +750,7 @@ namespace libtorrent } m_error = j.str; pause(); - m_ses.done_checking(shared_from_this()); + if (!m_abort) m_ses.done_checking(shared_from_this()); return; } diff --git a/libtorrent/src/upnp.cpp b/libtorrent/src/upnp.cpp index 802b55191..4db690cfa 100644 --- a/libtorrent/src/upnp.cpp +++ b/libtorrent/src/upnp.cpp @@ -903,8 +903,16 @@ void upnp::on_upnp_xml(error_code const& e } } - if (s.url_base.empty()) d.control_url = s.control_url; - else d.control_url = s.url_base + s.control_url; + if (!s.url_base.empty()) + { + // avoid double slashes in path + if (s.url_base[s.url_base.size()-1] == '/' + && !s.control_url.empty() + && s.control_url[0] == '/') + s.url_base.erase(s.url_base.end()-1); + d.control_url = s.url_base + s.control_url; + } + else d.control_url = s.control_url; std::string protocol; std::string auth;