added more output to transfer tests and changed the data to be more easily debuggable + some code cleanup

This commit is contained in:
Arvid Norberg 2007-06-20 18:41:53 +00:00
parent 31fb287c39
commit 0d7a208865
4 changed files with 10 additions and 5 deletions

View File

@ -499,7 +499,7 @@ namespace libtorrent
{ {
// we couldn't find the torrent! // we couldn't find the torrent!
#ifdef TORRENT_VERBOSE_LOGGING #ifdef TORRENT_VERBOSE_LOGGING
(*m_logger) << " couldn't find a torrent with the given info_hash\n"; (*m_logger) << " couldn't find a torrent with the given info_hash: " << ih << "\n";
#endif #endif
throw std::runtime_error("got info-hash that is not in our session"); throw std::runtime_error("got info-hash that is not in our session");
} }
@ -2254,7 +2254,6 @@ namespace libtorrent
assert(m_reading); assert(m_reading);
m_reading = false; m_reading = false;
if (error) if (error)
{ {
#ifdef TORRENT_VERBOSE_LOGGING #ifdef TORRENT_VERBOSE_LOGGING

View File

@ -1779,7 +1779,7 @@ namespace libtorrent
= instantiate_connection(m_ses.m_io_service, m_ses.peer_proxy()); = instantiate_connection(m_ses.m_io_service, m_ses.peer_proxy());
boost::intrusive_ptr<peer_connection> c(new bt_peer_connection( boost::intrusive_ptr<peer_connection> c(new bt_peer_connection(
m_ses, shared_from_this(), s, a, peerinfo)); m_ses, shared_from_this(), s, a, peerinfo));
#ifndef NDEBUG #ifndef NDEBUG
c->m_in_constructor = false; c->m_in_constructor = false;
#endif #endif

View File

@ -52,7 +52,8 @@ setup_transfer(session* ses1, session* ses2, session* ses3
t.add_tracker(tracker_url); t.add_tracker(tracker_url);
std::vector<char> piece(16 * 1024); std::vector<char> piece(16 * 1024);
std::fill(piece.begin(), piece.end(), 0xfe); for (int i = 0; i < piece.size(); ++i)
piece[i] = (i % 26) + 'A';
// calculate the hash for all pieces // calculate the hash for all pieces
int num = t.num_pieces(); int num = t.num_pieces();
@ -71,7 +72,7 @@ setup_transfer(session* ses1, session* ses2, session* ses3
if (clear_files) remove_all("./tmp2/temporary"); if (clear_files) remove_all("./tmp2/temporary");
t.create_torrent(); t.create_torrent();
std::cerr << "generated torrent: " << t.info_hash() << std::endl;
ses1->set_severity_level(alert::debug); ses1->set_severity_level(alert::debug);
ses2->set_severity_level(alert::debug); ses2->set_severity_level(alert::debug);

View File

@ -21,6 +21,11 @@ void test_transfer(bool clear_files = true, bool disconnect = false)
ses2.add_extension(&create_metadata_plugin); ses2.add_extension(&create_metadata_plugin);
torrent_handle tor1; torrent_handle tor1;
torrent_handle tor2; torrent_handle tor2;
pe_settings pes;
pes.out_enc_policy = pe_settings::disabled;
pes.in_enc_policy = pe_settings::disabled;
ses1.set_pe_settings(pes);
ses2.set_pe_settings(pes);
boost::tie(tor1, tor2, ignore) = setup_transfer(&ses1, &ses2, 0, clear_files); boost::tie(tor1, tor2, ignore) = setup_transfer(&ses1, &ses2, 0, clear_files);