diff --git a/examples/Jamfile b/examples/Jamfile index 8fa40712d..0a6d53f5d 100644 --- a/examples/Jamfile +++ b/examples/Jamfile @@ -20,10 +20,8 @@ project client_test ; exe client_test : client_test.cpp - : source:/boost/program_options - source:/boost/regex - system:program-options - system:regex + : /boost/program_options + /boost/regex ; exe simple_client : simple_client.cpp ; diff --git a/src/policy.cpp b/src/policy.cpp index 4f2e6211a..2419cace7 100755 --- a/src/policy.cpp +++ b/src/policy.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& dq = c.download_queue(); const std::deque& 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(), _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; diff --git a/src/torrent_info.cpp b/src/torrent_info.cpp index 4ea09aefd..e43f3f297 100755 --- a/src/torrent_info.cpp +++ b/src/torrent_info.cpp @@ -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 diff --git a/test/test_web_seed.cpp b/test/test_web_seed.cpp index a92b1a3be..4b981e50c 100644 --- a/test/test_web_seed.cpp +++ b/test/test_web_seed.cpp @@ -2,9 +2,11 @@ #include "libtorrent/hasher.hpp" #include "libtorrent/file_pool.hpp" #include "libtorrent/storage.hpp" +#include "libtorrent/bencode.hpp" #include #include #include +#include #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(torrent), te); session ses; ses.set_severity_level(alert::debug);