diff --git a/ChangeLog b/ChangeLog index db3d17e8b..cd976f1b4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -84,6 +84,7 @@ * resume data no longer has timestamps of files * require C++11 to build libtorrent + * set the hidden attribute when creating the part file * fix recent regression with force_proxy setting * don't perform DNS lookups for the DHT bootstrap unless DHT is enabled * fix issue where setting file/piece priority would stop checking diff --git a/include/libtorrent/alert_types.hpp b/include/libtorrent/alert_types.hpp index 7e1898329..278b44c7a 100644 --- a/include/libtorrent/alert_types.hpp +++ b/include/libtorrent/alert_types.hpp @@ -1642,7 +1642,7 @@ TORRENT_VERSION_NAMESPACE_2 , torrent_handle const& h, error_code const& ec, string_view file , operation_t op); - TORRENT_DEFINE_ALERT(fastresume_rejected_alert, 53) + TORRENT_DEFINE_ALERT_PRIO(fastresume_rejected_alert, 53, alert_priority_critical) static constexpr alert_category_t static_category = alert::status_notification | alert::error_notification; diff --git a/src/file.cpp b/src/file.cpp index 0b0509fad..e21af118e 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -530,14 +530,14 @@ static_assert(!(open_mode::sparse & open_mode::attribute_mask), "internal flags TORRENT_ASSERT(static_cast(mode & open_mode::rw_mask) < mode_array.size()); win_open_mode_t const& m = mode_array[static_cast(mode & open_mode::rw_mask)]; - DWORD a = attrib_array[static_cast(mode & open_mode::attribute_mask) >> 12]; + DWORD a = attrib_array[static_cast(mode & open_mode::attribute_mask) >> 7]; // one might think it's a good idea to pass in FILE_FLAG_RANDOM_ACCESS. It // turns out that it isn't. That flag will break your operating system: // http://support.microsoft.com/kb/2549369 DWORD const flags = ((mode & open_mode::random_access) ? 0 : FILE_FLAG_SEQUENTIAL_SCAN) - | (a ? a : FILE_ATTRIBUTE_NORMAL) + | a | FILE_FLAG_OVERLAPPED | ((mode & open_mode::no_cache) ? FILE_FLAG_WRITE_THROUGH : 0); diff --git a/src/part_file.cpp b/src/part_file.cpp index d9500e9d8..692217ff3 100644 --- a/src/part_file.cpp +++ b/src/part_file.cpp @@ -178,7 +178,7 @@ namespace libtorrent { TORRENT_ASSERT(offset >= 0); std::unique_lock l(m_mutex); - open_file(open_mode::read_write, ec); + open_file(open_mode::read_write | open_mode::attribute_hidden, ec); if (ec) return -1; auto const i = m_piece_map.find(piece); @@ -206,7 +206,7 @@ namespace libtorrent { } slot_index_t const slot = i->second; - open_file(open_mode::read_write, ec); + open_file(open_mode::read_write | open_mode::attribute_hidden, ec); if (ec) return -1; l.unlock(); @@ -375,7 +375,7 @@ namespace libtorrent { return; } - open_file(open_mode::read_write, ec); + open_file(open_mode::read_write | open_mode::attribute_hidden, ec); if (ec) return; std::vector header(static_cast(m_header_size)); diff --git a/src/storage.cpp b/src/storage.cpp index 0ecd952e4..027df4027 100644 --- a/src/storage.cpp +++ b/src/storage.cpp @@ -160,11 +160,10 @@ namespace libtorrent { { // move stuff into the part file // this is not implemented yet. - // pretend that we didn't set the priority to 0. + // so we just don't use a partfile for this file - std::string fp = fs.file_path(i, m_save_path); - if (exists(fp)) - new_prio = low_priority; + std::string const fp = fs.file_path(i, m_save_path); + if (exists(fp)) use_partfile(i, false); /* file_handle f = open_file(i, open_mode::read_only, ec); if (ec.ec != boost::system::errc::no_such_file_or_directory) diff --git a/test/test_alert_types.cpp b/test/test_alert_types.cpp index 65ce6baf8..d97ed7e46 100644 --- a/test/test_alert_types.cpp +++ b/test/test_alert_types.cpp @@ -121,7 +121,7 @@ TORRENT_TEST(alerts_types) TEST_ALERT_TYPE(portmap_error_alert, 50, 0, alert::port_mapping_notification | alert::error_notification); TEST_ALERT_TYPE(portmap_alert, 51, 0, alert::port_mapping_notification); TEST_ALERT_TYPE(portmap_log_alert, 52, 0, alert::port_mapping_log_notification); - TEST_ALERT_TYPE(fastresume_rejected_alert, 53, 0, alert::status_notification | alert::error_notification); + TEST_ALERT_TYPE(fastresume_rejected_alert, 53, 2, alert::status_notification | alert::error_notification); TEST_ALERT_TYPE(peer_blocked_alert, 54, 0, alert::ip_block_notification); TEST_ALERT_TYPE(dht_announce_alert, 55, 0, alert::dht_notification); TEST_ALERT_TYPE(dht_get_peers_alert, 56, 0, alert::dht_notification);