Browse Source

less noisy

miguelfreitas
Miguel Freitas 11 years ago
parent
commit
60db413630
  1. 13
      libtorrent/src/kademlia/node.cpp
  2. 4
      libtorrent/src/session_impl.cpp
  3. 2
      libtorrent/src/torrent.cpp
  4. 11
      src/twister.cpp

13
libtorrent/src/kademlia/node.cpp

@ -531,11 +531,12 @@ bool node_impl::refresh_storage() { @@ -531,11 +531,12 @@ bool node_impl::refresh_storage() {
if( refresh_next_item ) {
refresh_next_item = false;
m_last_refreshed_item = i->first;
#ifdef TORRENT_DHT_VERBOSE_LOGGING
printf("node dht: refreshing storage: [%s,%s,%s]\n",
username.c_str(),
resource.c_str(),
target->dict_find_string_value("t").c_str());
#endif
entry entryP;
entryP = p; // lazy to non-lazy
@ -1213,13 +1214,13 @@ void node_impl::incoming_request(msg const& m, entry& e) @@ -1213,13 +1214,13 @@ void node_impl::incoming_request(msg const& m, entry& e)
std::pair<char const*, int> targetbuf = msg_keys[mk_target]->data_section();
sha1_hash target = hasher(targetbuf.first,targetbuf.second).final();
//#ifdef TORRENT_DHT_VERBOSE_LOGGING
#ifdef TORRENT_DHT_VERBOSE_LOGGING
printf("PUT target={%s,%s,%s} from=%s:%d\n"
, msg_keys[mk_n]->string_value().c_str()
, msg_keys[mk_r]->string_value().c_str()
, msg_keys[mk_t]->string_value().c_str()
, m.addr.address().to_string().c_str(), m.addr.port());
//#endif
#endif
// verify the write-token. tokens are only valid to write to
// specific target hashes. it must match the one we got a "get" for
@ -1391,13 +1392,13 @@ void node_impl::incoming_request(msg const& m, entry& e) @@ -1391,13 +1392,13 @@ void node_impl::incoming_request(msg const& m, entry& e)
bool justtoken = false;
if (msg_keys[mk_justtoken] && msg_keys[mk_justtoken]->int_value() != 0) justtoken = true;
//#ifdef TORRENT_DHT_VERBOSE_LOGGING
#ifdef TORRENT_DHT_VERBOSE_LOGGING
printf("GET target={%s,%s,%s} from=%s:%d\n"
, msg_keys[mk_n]->string_value().c_str()
, msg_keys[mk_r]->string_value().c_str()
, msg_keys[mk_t]->string_value().c_str()
, m.addr.address().to_string().c_str(), m.addr.port());
//#endif
#endif
reply["token"] = generate_token(m.addr, target.to_string().c_str());
nodes_t n;
@ -1410,7 +1411,7 @@ void node_impl::incoming_request(msg const& m, entry& e) @@ -1410,7 +1411,7 @@ void node_impl::incoming_request(msg const& m, entry& e)
if( msg_keys[mk_r]->string_value() == "tracker" ) {
lookup_peers(target, 20, reply, false, false);
entry::list_type& pe = reply["values"].list();
printf("tracker=> replying with %d peers\n", pe.size());
//printf("tracker=> replying with %d peers\n", pe.size());
} else {
dht_storage_table_t::iterator i = m_storage_table.find(target);
if (i != m_storage_table.end())

4
libtorrent/src/session_impl.cpp

@ -2954,8 +2954,10 @@ retry: @@ -2954,8 +2954,10 @@ retry:
#endif
#if defined(TORRENT_LOGGING)
/*
session_log(" CLOSING CONNECTION %s : %s"
, print_endpoint(p->remote()).c_str(), ec.message().c_str());
*/
#endif
TORRENT_ASSERT(p->is_disconnecting());
@ -4224,7 +4226,7 @@ retry: @@ -4224,7 +4226,7 @@ retry:
--hard_limit;
--type_limit;
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING
t->log_to_all_peers("AUTO MANAGER STARTING TORRENT");
//t->log_to_all_peers("AUTO MANAGER STARTING TORRENT");
#endif
t->set_allow_peers(true);
}

2
libtorrent/src/torrent.cpp

@ -2154,7 +2154,7 @@ namespace libtorrent @@ -2154,7 +2154,7 @@ namespace libtorrent
if (m_trackers.empty())
{
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING
debug_log("*** announce_with_tracker: no trackers");
//debug_log("*** announce_with_tracker: no trackers");
#endif
return;
}

11
src/twister.cpp

@ -33,7 +33,8 @@ twister::twister() @@ -33,7 +33,8 @@ twister::twister()
#include "libtorrent/aux_/session_impl.hpp"
#define DEBUG_ACCEPT_POST 1
#define DEBUG_EXPIRE_DHT_ITEM 1
//#define DEBUG_EXPIRE_DHT_ITEM 1
//#define DEBUG_MAINTAIN_DHT_NODES 1
using namespace libtorrent;
static session *ses = NULL;
@ -389,7 +390,9 @@ void ThreadMaintainDHTNodes() @@ -389,7 +390,9 @@ void ThreadMaintainDHTNodes()
BOOST_FOREACH(const CAddress &a, vAddr) {
std::string addr = a.ToStringIP();
int port = a.GetPort() + LIBTORRENT_PORT_OFFSET;
#ifdef DEBUG_MAINTAIN_DHT_NODES
printf("Adding dht node (addrman) %s:%d\n", addr.c_str(), port);
#endif
ses->add_dht_node(std::pair<std::string, int>(addr, port));
nodesAdded = true;
}
@ -403,8 +406,10 @@ void ThreadMaintainDHTNodes() @@ -403,8 +406,10 @@ void ThreadMaintainDHTNodes()
int port = (!pnode->fInbound) ? pnode->addr.GetPort() : Params().GetDefaultPort();
port += LIBTORRENT_PORT_OFFSET;
#ifdef DEBUG_MAINTAIN_DHT_NODES
printf("Adding dht node (%sbound) %s:%d\n", (!pnode->fInbound) ? "out" : "in",
addr.c_str(), port);
#endif
ses->add_dht_node(std::pair<std::string, int>(addr, port));
nodesAdded = true;
}
@ -441,9 +446,11 @@ void ThreadMaintainDHTNodes() @@ -441,9 +446,11 @@ void ThreadMaintainDHTNodes()
for( size_t i = 0; i < ss.dht_routing_table.size(); i++ ) {
dht_routing_bucket &bucket = ss.dht_routing_table[i];
if( bucket.num_nodes ) {
#ifdef DEBUG_MAINTAIN_DHT_NODES
printf("DHT bucket [%zd] random node = %s:%d\n", i,
bucket.random_node.address().to_string().c_str(),
bucket.random_node.port);
#endif
char nodeStr[64];
sprintf(nodeStr,"%s:%d", bucket.random_node.address().to_string().c_str(),
bucket.random_node.port - LIBTORRENT_PORT_OFFSET);
@ -507,8 +514,10 @@ void ThreadSessionAlerts() @@ -507,8 +514,10 @@ void ThreadSessionAlerts()
alert_manager *am = (*mi).second;
am->post_alert(*rd);
} else {
/* FIXME: we could use multiple dht responses instead of ignoring here.
printf("ThreadSessionAlerts: received dht [%s,%s,%s] but no alert_manager registered\n",
n->string().c_str(), r->string().c_str(), t->string().c_str() );
*/
}
}
}

Loading…
Cancel
Save