fix dht logging build

This commit is contained in:
Arvid Norberg 2015-03-13 05:53:22 +00:00
parent 881fa4dce6
commit 65a9d76938
6 changed files with 16 additions and 16 deletions

View File

@ -553,7 +553,7 @@ namespace libtorrent
ipv6_peers.clear(); ipv6_peers.clear();
} }
#else #else
bdecode_node ipv6_peers = 0; bdecode_node ipv6_peers;
#endif #endif
/* /*
// if we didn't receive any peers. We don't care if we're stopping anyway // if we didn't receive any peers. We don't care if we're stopping anyway

View File

@ -76,7 +76,7 @@ namespace libtorrent { namespace dht
{ {
bdecode_node ver = e.dict_find_string("v"); bdecode_node ver = e.dict_find_string("v");
if (!ver) return "generic"; if (!ver) return "generic";
std::string const& client = ver->string_value(); std::string const& client = ver.string_value();
if (client.size() < 2) if (client.size() < 2)
{ {
return client; return client;
@ -408,7 +408,7 @@ namespace libtorrent { namespace dht
{ {
#ifdef TORRENT_DHT_VERBOSE_LOGGING #ifdef TORRENT_DHT_VERBOSE_LOGGING
TORRENT_LOG(dht_tracker) << "<== " << ep << " ERROR: not a dictionary: " TORRENT_LOG(dht_tracker) << "<== " << ep << " ERROR: not a dictionary: "
<< print_entry(e, true); << print_entry(m_msg, true);
#endif #endif
// it's not a good idea to send invalid messages // it's not a good idea to send invalid messages
// especially not in response to an invalid message // especially not in response to an invalid message

View File

@ -73,11 +73,11 @@ void get_peers_observer::reply(msg const& m)
{ {
TORRENT_LOG(traversal) TORRENT_LOG(traversal)
<< "[" << m_algorithm.get() << "] PEERS" << "[" << m_algorithm.get() << "] PEERS"
<< " invoke-count: " << m_algorithm.invoke_count() << " invoke-count: " << m_algorithm->invoke_count()
<< " branch-factor: " << m_algorithm.branch_factor() << " branch-factor: " << m_algorithm->branch_factor()
<< " addr: " << m.addr << " addr: " << m.addr
<< " id: " << node_id(id.string_ptr()) << " id: " << node_id(id.string_ptr())
<< " distance: " << distance_exp(m_algorithm.target(), node_id(id.string_ptr())) << " distance: " << distance_exp(m_algorithm->target(), node_id(id.string_ptr()))
<< " p: " << ((end - peers) / 6); << " p: " << ((end - peers) / 6);
} }
#endif #endif
@ -98,7 +98,7 @@ void get_peers_observer::reply(msg const& m)
<< " branch-factor: " << m_algorithm->branch_factor() << " branch-factor: " << m_algorithm->branch_factor()
<< " addr: " << m.addr << " addr: " << m.addr
<< " id: " << node_id(id.string_ptr()) << " id: " << node_id(id.string_ptr())
<< " distance: " << distance_exp(m_algorithm->target(), node_id(id->string_ptr())) << " distance: " << distance_exp(m_algorithm->target(), node_id(id.string_ptr()))
<< " p: " << n.list_size(); << " p: " << n.list_size();
} }
#endif #endif

View File

@ -248,7 +248,7 @@ void rpc_manager::check_invariant() const
void rpc_manager::unreachable(udp::endpoint const& ep) void rpc_manager::unreachable(udp::endpoint const& ep)
{ {
#ifdef TORRENT_DHT_VERBOSE_LOGGING #ifdef TORRENT_DHT_VERBOSE_LOGGING
TORRENT_LOG(rpc) << time_now_string() << " PORT_UNREACHABLE [ ip: " << ep << " ]"; TORRENT_LOG(rpc) << aux::time_now_string() << " PORT_UNREACHABLE [ ip: " << ep << " ]";
#endif #endif
for (transactions_t::iterator i = m_transactions.begin(); for (transactions_t::iterator i = m_transactions.begin();

View File

@ -243,7 +243,7 @@ void traversal_algorithm::traverse(node_id const& id, udp::endpoint addr)
#ifdef TORRENT_DHT_VERBOSE_LOGGING #ifdef TORRENT_DHT_VERBOSE_LOGGING
if (id.is_all_zeros()) if (id.is_all_zeros())
{ {
TORRENT_LOG(traversal) << time_now_string() << "[" << this << "] WARNING node returned a list which included a node with id 0"; TORRENT_LOG(traversal) << aux::time_now_string() << "[" << this << "] WARNING node returned a list which included a node with id 0";
} }
#endif #endif
@ -535,9 +535,9 @@ void traversal_observer::reply(msg const& m)
bdecode_node nid = r.dict_find_string("id"); bdecode_node nid = r.dict_find_string("id");
TORRENT_LOG(traversal) << "[" << m_algorithm.get() << "] " TORRENT_LOG(traversal) << "[" << m_algorithm.get() << "] "
"RESPONSE id: " << to_hex(nid.string_value()) "RESPONSE id: " << to_hex(nid.string_value())
<< " invoke-count: " << m_algorithm.invoke_count() << " invoke-count: " << m_algorithm->invoke_count()
<< " addr: " << m.addr << " addr: " << m.addr
<< " type: " << m_algorithm.name() << " type: " << m_algorithm->name()
; ;
#endif #endif
// look for nodes // look for nodes

View File

@ -116,7 +116,7 @@ void test_ssl(int test_idx, bool use_utp)
test_config_t const& test = test_config[test_idx]; test_config_t const& test = test_config[test_idx];
fprintf(stderr, "\n%s TEST: %s Protocol: %s\n\n", time_now_string(), test.name, use_utp ? "uTP": "TCP"); fprintf(stderr, "\n%s TEST: %s Protocol: %s\n\n", aux::time_now_string(), test.name, use_utp ? "uTP": "TCP");
// in case the previous run was terminated // in case the previous run was terminated
error_code ec; error_code ec;
@ -206,7 +206,7 @@ void test_ssl(int test_idx, bool use_utp)
port = ses2.listen_port(); port = ses2.listen_port();
fprintf(stderr, "%s: ses1: connecting peer port: %d\n" fprintf(stderr, "%s: ses1: connecting peer port: %d\n"
, time_now_string(), port); , aux::time_now_string(), port);
tor1.connect_peer(tcp::endpoint(address::from_string("127.0.0.1", ec) tor1.connect_peer(tcp::endpoint(address::from_string("127.0.0.1", ec)
, port)); , port));
@ -225,7 +225,7 @@ void test_ssl(int test_idx, bool use_utp)
if (i % 10 == 0) if (i % 10 == 0)
{ {
std::cerr << time_now_string() << " " std::cerr << aux::time_now_string() << " "
<< "\033[32m" << int(st1.download_payload_rate / 1000.f) << "kB/s " << "\033[32m" << int(st1.download_payload_rate / 1000.f) << "kB/s "
<< "\033[33m" << int(st1.upload_payload_rate / 1000.f) << "kB/s " << "\033[33m" << int(st1.upload_payload_rate / 1000.f) << "kB/s "
<< "\033[0m" << int(st1.progress * 100) << "% " << "\033[0m" << int(st1.progress * 100) << "% "
@ -270,8 +270,8 @@ void test_ssl(int test_idx, bool use_utp)
fprintf(stderr, "ssl_disconnects: %d expected: %d\n", ssl_peer_disconnects, test.ssl_disconnects); fprintf(stderr, "ssl_disconnects: %d expected: %d\n", ssl_peer_disconnects, test.ssl_disconnects);
TEST_EQUAL(ssl_peer_disconnects > 0, test.ssl_disconnects > 0); TEST_EQUAL(ssl_peer_disconnects > 0, test.ssl_disconnects > 0);
fprintf(stderr, "%s: EXPECT: %s\n", time_now_string(), test.expected_to_complete ? "SUCCEESS" : "FAILURE"); fprintf(stderr, "%s: EXPECT: %s\n", aux::time_now_string(), test.expected_to_complete ? "SUCCEESS" : "FAILURE");
fprintf(stderr, "%s: RESULT: %s\n", time_now_string(), tor2.status().is_seeding ? "SUCCEESS" : "FAILURE"); fprintf(stderr, "%s: RESULT: %s\n", aux::time_now_string(), tor2.status().is_seeding ? "SUCCEESS" : "FAILURE");
TEST_EQUAL(tor2.status().is_seeding, test.expected_to_complete); TEST_EQUAL(tor2.status().is_seeding, test.expected_to_complete);
// this allows shutting down the sessions in parallel // this allows shutting down the sessions in parallel