lt sync 2823

This commit is contained in:
Andrew Resch 2008-10-17 17:54:07 +00:00
parent 86d1624cff
commit a555fecc18
4 changed files with 10 additions and 8 deletions

View File

@ -304,8 +304,8 @@ namespace libtorrent
TORRENT_ASSERT(t1);
boost::shared_ptr<torrent> t2 = rhs.associated_torrent().lock();
TORRENT_ASSERT(t2);
if (!is_choked()) c1 -= t1->torrent_file().piece_length();
if (!rhs.is_choked()) c2 -= t2->torrent_file().piece_length();
if (!is_choked()) c1 -= (std::max)(t1->torrent_file().piece_length(), 256 * 1024);
if (!rhs.is_choked()) c2 -= (std::max)(t2->torrent_file().piece_length(), 256 * 1024);
return c1 < c2;
}

View File

@ -996,10 +996,6 @@ namespace libtorrent
#ifdef TORRENT_PICKER_LOG
print_pieces();
#endif
#ifndef NDEBUG
check_invariant();
#endif
}
void piece_picker::we_dont_have(int index)

View File

@ -338,8 +338,7 @@ namespace libtorrent
piece_picker* p = 0;
if (m_torrent->has_picker())
p = &m_torrent->picker();
for (iterator i = m_peers.begin()
, end(m_peers.end()); i != end;)
for (iterator i = m_peers.begin(); i != m_peers.end();)
{
if ((ses.m_ip_filter.access(i->second.addr) & ip_filter::blocked) == 0)
{

View File

@ -309,6 +309,13 @@ namespace libtorrent
int ret = load_file(filename, buf);
if (ret < 0) return;
if (buf.empty())
#ifndef BOOST_NO_EXCEPTIONS
throw invalid_torrent_file();
#else
return;
#endif
lazy_entry e;
lazy_bdecode(&buf[0], &buf[0] + buf.size(), e);
std::string error;