forked from premiere/premiere-libtorrent
merge RC_1_1 into master
This commit is contained in:
commit
b97bb84a9f
|
@ -42,6 +42,8 @@
|
|||
* resume data no longer has timestamps of files
|
||||
* require C++11 to build libtorrent
|
||||
|
||||
* fix resumedata check issue with files with priority 0
|
||||
* deprecated mmap_cache feature
|
||||
* add utility function for generating peer ID fingerprint
|
||||
* fix bug in last-seen-complete
|
||||
* remove file size limit in torrent_info filename constructor
|
||||
|
|
|
@ -1838,7 +1838,8 @@ namespace libtorrent
|
|||
std::vector<torrent_status> const status;
|
||||
};
|
||||
|
||||
struct TORRENT_EXPORT mmap_cache_alert final : alert
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
struct TORRENT_DEPRECATED TORRENT_EXPORT mmap_cache_alert final : alert
|
||||
{
|
||||
mmap_cache_alert(aux::stack_allocator& alloc
|
||||
, error_code const& ec);
|
||||
|
@ -1849,6 +1850,7 @@ namespace libtorrent
|
|||
|
||||
error_code const error;
|
||||
};
|
||||
#endif
|
||||
|
||||
// The session_stats_alert is posted when the user requests session statistics by
|
||||
// calling post_session_stats() on the session object. Its category is
|
||||
|
@ -1883,7 +1885,7 @@ namespace libtorrent
|
|||
//
|
||||
// Once this download completes, the ``torrent_update_alert`` is posted to
|
||||
// notify the client of the info-hash changing.
|
||||
struct TORRENT_EXPORT torrent_update_alert final : torrent_alert
|
||||
struct TORRENT_DEPRECATED TORRENT_EXPORT torrent_update_alert final : torrent_alert
|
||||
{
|
||||
// internal
|
||||
torrent_update_alert(aux::stack_allocator& alloc, torrent_handle h
|
||||
|
|
|
@ -143,7 +143,7 @@ namespace libtorrent
|
|||
|
||||
int m_cache_buffer_chunk_size;
|
||||
|
||||
#if TORRENT_HAVE_MMAP
|
||||
#if TORRENT_HAVE_MMAP && !defined TORRENT_NO_DEPRECATE
|
||||
// the file descriptor of the cache mmap file
|
||||
int m_cache_fd;
|
||||
// the pointer to the block of virtual address space
|
||||
|
|
|
@ -124,6 +124,7 @@ namespace libtorrent
|
|||
// omitted.
|
||||
announce_ip,
|
||||
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
// ``mmap_cache`` may be set to a filename where the disk cache will
|
||||
// be mmapped to. This could be useful, for instance, to map the disk
|
||||
// cache from regular rotating hard drives onto an SSD drive. Doing
|
||||
|
@ -141,6 +142,9 @@ namespace libtorrent
|
|||
// This feature requires the ``mmap`` system call, on systems that
|
||||
// don't have ``mmap`` this setting is ignored.
|
||||
mmap_cache,
|
||||
#else
|
||||
deprecated12,
|
||||
#endif
|
||||
|
||||
// this is the client name and version identifier sent to peers in the
|
||||
// handshake message. If this is an empty string, the user_agent is
|
||||
|
|
|
@ -1409,6 +1409,7 @@ namespace libtorrent {
|
|||
return msg;
|
||||
}
|
||||
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
mmap_cache_alert::mmap_cache_alert(aux::stack_allocator&
|
||||
, error_code const& ec): error(ec)
|
||||
{}
|
||||
|
@ -1420,6 +1421,7 @@ namespace libtorrent {
|
|||
, convert_from_native(error.message()).c_str());
|
||||
return msg;
|
||||
}
|
||||
#endif
|
||||
|
||||
peer_error_alert::peer_error_alert(aux::stack_allocator& alloc, torrent_handle const& h
|
||||
, tcp::endpoint const& ep, peer_id const& peer_id, int op
|
||||
|
|
|
@ -81,7 +81,7 @@ namespace libtorrent
|
|||
, m_exceeded_max_size(false)
|
||||
, m_ios(ios)
|
||||
, m_cache_buffer_chunk_size(0)
|
||||
#if TORRENT_HAVE_MMAP
|
||||
#if TORRENT_HAVE_MMAP && !defined TORRENT_NO_DEPRECATE
|
||||
, m_cache_fd(-1)
|
||||
, m_cache_pool(nullptr)
|
||||
#endif
|
||||
|
@ -104,7 +104,7 @@ namespace libtorrent
|
|||
m_magic = 0;
|
||||
#endif
|
||||
|
||||
#if TORRENT_HAVE_MMAP
|
||||
#if TORRENT_HAVE_MMAP && !defined TORRENT_NO_DEPRECATE
|
||||
if (m_cache_pool)
|
||||
{
|
||||
munmap(m_cache_pool, std::uint64_t(m_max_use) * 0x4000);
|
||||
|
@ -162,7 +162,7 @@ namespace libtorrent
|
|||
TORRENT_ASSERT(l.owns_lock());
|
||||
TORRENT_UNUSED(l);
|
||||
|
||||
#if TORRENT_HAVE_MMAP
|
||||
#if TORRENT_HAVE_MMAP && !defined TORRENT_NO_DEPRECATE
|
||||
if (m_cache_pool)
|
||||
{
|
||||
return buffer >= m_cache_pool && buffer < m_cache_pool
|
||||
|
@ -268,7 +268,7 @@ namespace libtorrent
|
|||
TORRENT_UNUSED(l);
|
||||
|
||||
char* ret;
|
||||
#if TORRENT_HAVE_MMAP
|
||||
#if TORRENT_HAVE_MMAP && !defined TORRENT_NO_DEPRECATE
|
||||
if (m_cache_pool)
|
||||
{
|
||||
if (m_free_list.size() <= (m_max_use - m_low_watermark)
|
||||
|
@ -385,7 +385,7 @@ namespace libtorrent
|
|||
m_using_pool_allocator = m_want_pool_allocator;
|
||||
#endif
|
||||
|
||||
#if TORRENT_HAVE_MMAP
|
||||
#if TORRENT_HAVE_MMAP && !defined TORRENT_NO_DEPRECATE
|
||||
// if we've already allocated an mmap, we can't change
|
||||
// anything unless there are no allocations in use
|
||||
if (m_cache_pool && m_in_use > 0) return;
|
||||
|
@ -394,10 +394,13 @@ namespace libtorrent
|
|||
// only allow changing size if we're not using mmapped
|
||||
// cache, or if we're just about to turn it off
|
||||
if (
|
||||
#if TORRENT_HAVE_MMAP
|
||||
#if TORRENT_HAVE_MMAP && !defined TORRENT_NO_DEPRECATE
|
||||
m_cache_pool == nullptr ||
|
||||
sett.get_str(settings_pack::mmap_cache).empty()
|
||||
#else
|
||||
true
|
||||
#endif
|
||||
sett.get_str(settings_pack::mmap_cache).empty())
|
||||
)
|
||||
{
|
||||
int const cache_size = sett.get_int(settings_pack::cache_size);
|
||||
if (cache_size < 0)
|
||||
|
@ -467,7 +470,7 @@ namespace libtorrent
|
|||
m_settings_set = true;
|
||||
#endif
|
||||
|
||||
#if TORRENT_HAVE_MMAP
|
||||
#if TORRENT_HAVE_MMAP && !defined TORRENT_NO_DEPRECATE
|
||||
// #error support resizing the map
|
||||
if (m_cache_pool && sett.get_str(settings_pack::mmap_cache).empty())
|
||||
{
|
||||
|
@ -532,7 +535,7 @@ namespace libtorrent
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif // TORRENT_HAVE_MMAP
|
||||
}
|
||||
|
||||
void disk_buffer_pool::remove_buffer_in_use(char* buf)
|
||||
|
@ -553,7 +556,7 @@ namespace libtorrent
|
|||
TORRENT_ASSERT(l.owns_lock());
|
||||
TORRENT_UNUSED(l);
|
||||
|
||||
#if TORRENT_HAVE_MMAP
|
||||
#if TORRENT_HAVE_MMAP && !defined TORRENT_NO_DEPRECATE
|
||||
if (m_cache_pool)
|
||||
{
|
||||
TORRENT_ASSERT(buf >= m_cache_pool);
|
||||
|
|
|
@ -283,10 +283,14 @@ namespace libtorrent
|
|||
apply_pack(pack, m_settings);
|
||||
error_code ec;
|
||||
m_disk_cache.set_settings(m_settings, ec);
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
if (ec && alerts.should_post<mmap_cache_alert>())
|
||||
{
|
||||
alerts.emplace_alert<mmap_cache_alert>(ec);
|
||||
}
|
||||
#else
|
||||
TORRENT_UNUSED(alerts);
|
||||
#endif
|
||||
}
|
||||
|
||||
// flush all blocks that are below p->hash.offset, since we've
|
||||
|
|
|
@ -878,6 +878,14 @@ namespace libtorrent
|
|||
TORRENT_ASSERT(!f.empty());
|
||||
|
||||
int const file_index = f[0].file_index;
|
||||
|
||||
// files with priority zero may not have been saved to disk at their
|
||||
// expected location, but is likely to be in a partfile. Just exempt it
|
||||
// from checking
|
||||
if (file_index < int(m_file_priority.size())
|
||||
&& m_file_priority[file_index] == 0)
|
||||
continue;
|
||||
|
||||
error_code error;
|
||||
std::int64_t const size = m_stat_cache.get_filesize(f[0].file_index
|
||||
, fs, m_save_path, error);
|
||||
|
|
|
@ -104,9 +104,9 @@ TORRENT_TEST(test_name)
|
|||
TEST_NAME(seeding_piece_quota);
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
TEST_NAME(half_open_limit);
|
||||
TEST_NAME(mmap_cache);
|
||||
#endif
|
||||
TEST_NAME(peer_turnover_interval);
|
||||
TEST_NAME(mmap_cache);
|
||||
TEST_NAME(peer_fingerprint);
|
||||
TEST_NAME(proxy_tracker_connections);
|
||||
TEST_NAME(cache_size_volatile);
|
||||
|
|
Loading…
Reference in New Issue