lt sync 2583
This commit is contained in:
parent
e1cc2d9e62
commit
221c0c31a4
|
@ -42,7 +42,7 @@ std::string demangle(char const* name);
|
||||||
#if (defined __linux__ || defined __MACH__) && defined __GNUC__ && !defined(NDEBUG)
|
#if (defined __linux__ || defined __MACH__) && defined __GNUC__ && !defined(NDEBUG)
|
||||||
|
|
||||||
TORRENT_EXPORT void assert_fail(const char* expr, int line, char const* file, char const* function);
|
TORRENT_EXPORT void assert_fail(const char* expr, int line, char const* file, char const* function);
|
||||||
#define TORRENT_ASSERT(x) if (x) {} else assert_fail(#x, __LINE__, __FILE__, __PRETTY_FUNCTION__)
|
#define TORRENT_ASSERT(x) do { if (x) {} else assert_fail(#x, __LINE__, __FILE__, __PRETTY_FUNCTION__); } while (false)
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
|
@ -78,10 +78,12 @@ namespace libtorrent
|
||||||
void add_url_seed(std::string const& url);
|
void add_url_seed(std::string const& url);
|
||||||
void add_node(std::pair<std::string, int> const& node);
|
void add_node(std::pair<std::string, int> const& node);
|
||||||
void add_tracker(std::string const& url, int tier = 0);
|
void add_tracker(std::string const& url, int tier = 0);
|
||||||
|
void set_priv(bool p) { m_private = p; }
|
||||||
|
|
||||||
int num_pieces() const { return m_files.num_pieces(); }
|
int num_pieces() const { return m_files.num_pieces(); }
|
||||||
int piece_length() const { return m_files.piece_length(); }
|
int piece_length() const { return m_files.piece_length(); }
|
||||||
int piece_size(int i) const { return m_files.piece_size(i); }
|
int piece_size(int i) const { return m_files.piece_size(i); }
|
||||||
|
bool priv() const { return m_private; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
|
@ -1153,7 +1153,8 @@ namespace libtorrent
|
||||||
#ifndef BOOST_NO_EXCEPTIONS
|
#ifndef BOOST_NO_EXCEPTIONS
|
||||||
try {
|
try {
|
||||||
#endif
|
#endif
|
||||||
TORRENT_ASSERT(ret != -2 || !j.str.empty());
|
TORRENT_ASSERT(ret != -2 || !j.str.empty()
|
||||||
|
|| j.action == disk_io_job::hash);
|
||||||
if (handler) m_ios.post(bind(handler, ret, j));
|
if (handler) m_ios.post(bind(handler, ret, j));
|
||||||
#ifndef BOOST_NO_EXCEPTIONS
|
#ifndef BOOST_NO_EXCEPTIONS
|
||||||
} catch (std::exception&)
|
} catch (std::exception&)
|
||||||
|
|
|
@ -201,8 +201,12 @@ namespace libtorrent
|
||||||
#else
|
#else
|
||||||
// rely on default umask to filter x and w permissions
|
// rely on default umask to filter x and w permissions
|
||||||
// for group and others
|
// for group and others
|
||||||
|
int permissions = S_IRUSR | S_IWUSR
|
||||||
|
| S_IRGRP | S_IWGRP
|
||||||
|
| S_IROTH | S_IWOTH;
|
||||||
|
|
||||||
m_fd = ::open(path.native_file_string().c_str()
|
m_fd = ::open(path.native_file_string().c_str()
|
||||||
, map_open_mode(mode.m_mask), S_IRWXU | S_IRWXG | S_IRWXO);
|
, map_open_mode(mode.m_mask), permissions);
|
||||||
|
|
||||||
if (m_fd == -1)
|
if (m_fd == -1)
|
||||||
{
|
{
|
||||||
|
|
|
@ -3710,13 +3710,13 @@ namespace libtorrent
|
||||||
#ifdef TORRENT_EXPENSIVE_INVARIANT_CHECKS
|
#ifdef TORRENT_EXPENSIVE_INVARIANT_CHECKS
|
||||||
if (m_peer_info)
|
if (m_peer_info)
|
||||||
{
|
{
|
||||||
policy::const_iterator i;
|
policy::const_iterator i = t->get_policy().begin_peer();
|
||||||
for (i = t->get_policy().begin_peer()
|
policy::const_iterator end = t->get_policy().end_peer();
|
||||||
, end(t->get_policy().end_peer()); i != end; ++i)
|
for (; i != end; ++i)
|
||||||
{
|
{
|
||||||
if (&i->second == m_peer_info) break;
|
if (&i->second == m_peer_info) break;
|
||||||
}
|
}
|
||||||
TORRENT_ASSERT(i != t->get_policy().end_peer());
|
TORRENT_ASSERT(i != end);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (t->has_picker() && !t->is_aborted())
|
if (t->has_picker() && !t->is_aborted())
|
||||||
|
|
|
@ -222,6 +222,7 @@ namespace libtorrent
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef TORRENT_PICKER_LOG
|
||||||
void piece_picker::print_pieces() const
|
void piece_picker::print_pieces() const
|
||||||
{
|
{
|
||||||
for (std::vector<int>::const_iterator i = m_priority_boundries.begin()
|
for (std::vector<int>::const_iterator i = m_priority_boundries.begin()
|
||||||
|
@ -245,6 +246,7 @@ namespace libtorrent
|
||||||
}
|
}
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void piece_picker::check_invariant(const torrent* t) const
|
void piece_picker::check_invariant(const torrent* t) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -3466,7 +3466,7 @@ namespace libtorrent
|
||||||
for (policy::const_iterator i = m_policy.begin_peer()
|
for (policy::const_iterator i = m_policy.begin_peer()
|
||||||
, end(m_policy.end_peer()); i != end; ++i)
|
, end(m_policy.end_peer()); i != end; ++i)
|
||||||
{
|
{
|
||||||
TORRENT_ASSERT(i->second.ip.address() == i->first);
|
TORRENT_ASSERT(i->second.addr == i->first);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -4144,7 +4144,6 @@ namespace libtorrent
|
||||||
TORRENT_ASSERT(valid_metadata());
|
TORRENT_ASSERT(valid_metadata());
|
||||||
|
|
||||||
fp.resize(m_torrent_file->num_files(), 0);
|
fp.resize(m_torrent_file->num_files(), 0);
|
||||||
TORRENT_ASSERT(has_picker());
|
|
||||||
|
|
||||||
if (is_seed())
|
if (is_seed())
|
||||||
{
|
{
|
||||||
|
@ -4153,6 +4152,8 @@ namespace libtorrent
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TORRENT_ASSERT(has_picker());
|
||||||
|
|
||||||
for (int i = 0; i < m_torrent_file->num_files(); ++i)
|
for (int i = 0; i < m_torrent_file->num_files(); ++i)
|
||||||
{
|
{
|
||||||
peer_request ret = m_torrent_file->files().map_file(i, 0, 0);
|
peer_request ret = m_torrent_file->files().map_file(i, 0, 0);
|
||||||
|
|
Loading…
Reference in New Issue