forked from premiere/premiere-libtorrent
updated piece_picker fix and added another invariant check to policy
This commit is contained in:
parent
a443225d49
commit
6c50adabfc
|
@ -20,10 +20,8 @@ project client_test
|
|||
;
|
||||
|
||||
exe client_test : client_test.cpp
|
||||
: <boost>source:<library>/boost/program_options
|
||||
<boost>source:<library>/boost/regex
|
||||
<boost>system:<library>program-options
|
||||
<boost>system:<library>regex
|
||||
: <library>/boost/program_options
|
||||
<library>/boost/regex
|
||||
;
|
||||
|
||||
exe simple_client : simple_client.cpp ;
|
||||
|
|
|
@ -280,6 +280,7 @@ namespace libtorrent
|
|||
{
|
||||
if (p.is_requested(*i))
|
||||
{
|
||||
if (num_requests <= 0) break;
|
||||
// don't request pieces we already have in our request queue
|
||||
const std::deque<piece_block>& dq = c.download_queue();
|
||||
const std::deque<piece_block>& rq = c.request_queue();
|
||||
|
@ -299,10 +300,9 @@ namespace libtorrent
|
|||
assert(p.num_peers(*i) == 1);
|
||||
assert(p.is_requested(*i));
|
||||
num_requests--;
|
||||
if (num_requests == 0) break;
|
||||
}
|
||||
|
||||
if (busy_pieces.empty() || num_requests == 0)
|
||||
if (busy_pieces.empty() || num_requests <= 0)
|
||||
{
|
||||
// in this case, we could not find any blocks
|
||||
// that was free. If we couldn't find any busy
|
||||
|
@ -1405,6 +1405,11 @@ namespace libtorrent
|
|||
, boost::bind(std::equal_to<peer_connection*>(), _1, p.connection))
|
||||
!= conns.end());
|
||||
}
|
||||
if (p.optimistically_unchoked)
|
||||
{
|
||||
assert(p.connection);
|
||||
assert(!p.connection->is_choked());
|
||||
}
|
||||
assert(p.connection->peer_info_struct() == 0
|
||||
|| p.connection->peer_info_struct() == &p);
|
||||
++nonempty_connections;
|
||||
|
|
|
@ -674,7 +674,7 @@ namespace libtorrent
|
|||
{
|
||||
assert(m_piece_length > 0);
|
||||
|
||||
if ((m_urls.empty() && m_nodes.empty()) || m_files.empty())
|
||||
if (m_files.empty())
|
||||
{
|
||||
// TODO: throw something here
|
||||
// throw
|
||||
|
|
|
@ -2,9 +2,11 @@
|
|||
#include "libtorrent/hasher.hpp"
|
||||
#include "libtorrent/file_pool.hpp"
|
||||
#include "libtorrent/storage.hpp"
|
||||
#include "libtorrent/bencode.hpp"
|
||||
#include <boost/thread.hpp>
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <fstream>
|
||||
|
||||
#include "test.hpp"
|
||||
#include "setup_transfer.hpp"
|
||||
|
@ -55,7 +57,11 @@ void test_transfer()
|
|||
}
|
||||
|
||||
// to calculate the info_hash
|
||||
torrent_file.create_torrent();
|
||||
entry te = torrent_file.create_torrent();
|
||||
|
||||
te.print(std::cout);
|
||||
// std::ofstream torrent("web_seed.torrent", std::ios::binary | std::ios::trunc);
|
||||
// bencode(std::ostream_iterator<char>(torrent), te);
|
||||
|
||||
session ses;
|
||||
ses.set_severity_level(alert::debug);
|
||||
|
|
Loading…
Reference in New Issue