mirror of
https://github.com/twisterarmy/twister-core.git
synced 2025-01-09 22:37:55 +00:00
less noisy
This commit is contained in:
parent
5fcf9b452a
commit
60db413630
@ -531,11 +531,12 @@ bool node_impl::refresh_storage() {
|
|||||||
if( refresh_next_item ) {
|
if( refresh_next_item ) {
|
||||||
refresh_next_item = false;
|
refresh_next_item = false;
|
||||||
m_last_refreshed_item = i->first;
|
m_last_refreshed_item = i->first;
|
||||||
|
#ifdef TORRENT_DHT_VERBOSE_LOGGING
|
||||||
printf("node dht: refreshing storage: [%s,%s,%s]\n",
|
printf("node dht: refreshing storage: [%s,%s,%s]\n",
|
||||||
username.c_str(),
|
username.c_str(),
|
||||||
resource.c_str(),
|
resource.c_str(),
|
||||||
target->dict_find_string_value("t").c_str());
|
target->dict_find_string_value("t").c_str());
|
||||||
|
#endif
|
||||||
|
|
||||||
entry entryP;
|
entry entryP;
|
||||||
entryP = p; // lazy to non-lazy
|
entryP = p; // lazy to non-lazy
|
||||||
@ -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();
|
std::pair<char const*, int> targetbuf = msg_keys[mk_target]->data_section();
|
||||||
sha1_hash target = hasher(targetbuf.first,targetbuf.second).final();
|
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"
|
printf("PUT target={%s,%s,%s} from=%s:%d\n"
|
||||||
, msg_keys[mk_n]->string_value().c_str()
|
, msg_keys[mk_n]->string_value().c_str()
|
||||||
, msg_keys[mk_r]->string_value().c_str()
|
, msg_keys[mk_r]->string_value().c_str()
|
||||||
, msg_keys[mk_t]->string_value().c_str()
|
, msg_keys[mk_t]->string_value().c_str()
|
||||||
, m.addr.address().to_string().c_str(), m.addr.port());
|
, m.addr.address().to_string().c_str(), m.addr.port());
|
||||||
//#endif
|
#endif
|
||||||
|
|
||||||
// verify the write-token. tokens are only valid to write to
|
// verify the write-token. tokens are only valid to write to
|
||||||
// specific target hashes. it must match the one we got a "get" for
|
// 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)
|
|||||||
bool justtoken = false;
|
bool justtoken = false;
|
||||||
if (msg_keys[mk_justtoken] && msg_keys[mk_justtoken]->int_value() != 0) justtoken = true;
|
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"
|
printf("GET target={%s,%s,%s} from=%s:%d\n"
|
||||||
, msg_keys[mk_n]->string_value().c_str()
|
, msg_keys[mk_n]->string_value().c_str()
|
||||||
, msg_keys[mk_r]->string_value().c_str()
|
, msg_keys[mk_r]->string_value().c_str()
|
||||||
, msg_keys[mk_t]->string_value().c_str()
|
, msg_keys[mk_t]->string_value().c_str()
|
||||||
, m.addr.address().to_string().c_str(), m.addr.port());
|
, m.addr.address().to_string().c_str(), m.addr.port());
|
||||||
//#endif
|
#endif
|
||||||
reply["token"] = generate_token(m.addr, target.to_string().c_str());
|
reply["token"] = generate_token(m.addr, target.to_string().c_str());
|
||||||
|
|
||||||
nodes_t n;
|
nodes_t n;
|
||||||
@ -1410,7 +1411,7 @@ void node_impl::incoming_request(msg const& m, entry& e)
|
|||||||
if( msg_keys[mk_r]->string_value() == "tracker" ) {
|
if( msg_keys[mk_r]->string_value() == "tracker" ) {
|
||||||
lookup_peers(target, 20, reply, false, false);
|
lookup_peers(target, 20, reply, false, false);
|
||||||
entry::list_type& pe = reply["values"].list();
|
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 {
|
} else {
|
||||||
dht_storage_table_t::iterator i = m_storage_table.find(target);
|
dht_storage_table_t::iterator i = m_storage_table.find(target);
|
||||||
if (i != m_storage_table.end())
|
if (i != m_storage_table.end())
|
||||||
|
@ -2954,8 +2954,10 @@ retry:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(TORRENT_LOGGING)
|
#if defined(TORRENT_LOGGING)
|
||||||
|
/*
|
||||||
session_log(" CLOSING CONNECTION %s : %s"
|
session_log(" CLOSING CONNECTION %s : %s"
|
||||||
, print_endpoint(p->remote()).c_str(), ec.message().c_str());
|
, print_endpoint(p->remote()).c_str(), ec.message().c_str());
|
||||||
|
*/
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
TORRENT_ASSERT(p->is_disconnecting());
|
TORRENT_ASSERT(p->is_disconnecting());
|
||||||
@ -4224,7 +4226,7 @@ retry:
|
|||||||
--hard_limit;
|
--hard_limit;
|
||||||
--type_limit;
|
--type_limit;
|
||||||
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING
|
#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
|
#endif
|
||||||
t->set_allow_peers(true);
|
t->set_allow_peers(true);
|
||||||
}
|
}
|
||||||
|
@ -2154,7 +2154,7 @@ namespace libtorrent
|
|||||||
if (m_trackers.empty())
|
if (m_trackers.empty())
|
||||||
{
|
{
|
||||||
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING
|
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING
|
||||||
debug_log("*** announce_with_tracker: no trackers");
|
//debug_log("*** announce_with_tracker: no trackers");
|
||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,8 @@ twister::twister()
|
|||||||
#include "libtorrent/aux_/session_impl.hpp"
|
#include "libtorrent/aux_/session_impl.hpp"
|
||||||
|
|
||||||
#define DEBUG_ACCEPT_POST 1
|
#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;
|
using namespace libtorrent;
|
||||||
static session *ses = NULL;
|
static session *ses = NULL;
|
||||||
@ -389,7 +390,9 @@ void ThreadMaintainDHTNodes()
|
|||||||
BOOST_FOREACH(const CAddress &a, vAddr) {
|
BOOST_FOREACH(const CAddress &a, vAddr) {
|
||||||
std::string addr = a.ToStringIP();
|
std::string addr = a.ToStringIP();
|
||||||
int port = a.GetPort() + LIBTORRENT_PORT_OFFSET;
|
int port = a.GetPort() + LIBTORRENT_PORT_OFFSET;
|
||||||
|
#ifdef DEBUG_MAINTAIN_DHT_NODES
|
||||||
printf("Adding dht node (addrman) %s:%d\n", addr.c_str(), port);
|
printf("Adding dht node (addrman) %s:%d\n", addr.c_str(), port);
|
||||||
|
#endif
|
||||||
ses->add_dht_node(std::pair<std::string, int>(addr, port));
|
ses->add_dht_node(std::pair<std::string, int>(addr, port));
|
||||||
nodesAdded = true;
|
nodesAdded = true;
|
||||||
}
|
}
|
||||||
@ -403,8 +406,10 @@ void ThreadMaintainDHTNodes()
|
|||||||
int port = (!pnode->fInbound) ? pnode->addr.GetPort() : Params().GetDefaultPort();
|
int port = (!pnode->fInbound) ? pnode->addr.GetPort() : Params().GetDefaultPort();
|
||||||
port += LIBTORRENT_PORT_OFFSET;
|
port += LIBTORRENT_PORT_OFFSET;
|
||||||
|
|
||||||
|
#ifdef DEBUG_MAINTAIN_DHT_NODES
|
||||||
printf("Adding dht node (%sbound) %s:%d\n", (!pnode->fInbound) ? "out" : "in",
|
printf("Adding dht node (%sbound) %s:%d\n", (!pnode->fInbound) ? "out" : "in",
|
||||||
addr.c_str(), port);
|
addr.c_str(), port);
|
||||||
|
#endif
|
||||||
ses->add_dht_node(std::pair<std::string, int>(addr, port));
|
ses->add_dht_node(std::pair<std::string, int>(addr, port));
|
||||||
nodesAdded = true;
|
nodesAdded = true;
|
||||||
}
|
}
|
||||||
@ -441,9 +446,11 @@ void ThreadMaintainDHTNodes()
|
|||||||
for( size_t i = 0; i < ss.dht_routing_table.size(); i++ ) {
|
for( size_t i = 0; i < ss.dht_routing_table.size(); i++ ) {
|
||||||
dht_routing_bucket &bucket = ss.dht_routing_table[i];
|
dht_routing_bucket &bucket = ss.dht_routing_table[i];
|
||||||
if( bucket.num_nodes ) {
|
if( bucket.num_nodes ) {
|
||||||
|
#ifdef DEBUG_MAINTAIN_DHT_NODES
|
||||||
printf("DHT bucket [%zd] random node = %s:%d\n", i,
|
printf("DHT bucket [%zd] random node = %s:%d\n", i,
|
||||||
bucket.random_node.address().to_string().c_str(),
|
bucket.random_node.address().to_string().c_str(),
|
||||||
bucket.random_node.port);
|
bucket.random_node.port);
|
||||||
|
#endif
|
||||||
char nodeStr[64];
|
char nodeStr[64];
|
||||||
sprintf(nodeStr,"%s:%d", bucket.random_node.address().to_string().c_str(),
|
sprintf(nodeStr,"%s:%d", bucket.random_node.address().to_string().c_str(),
|
||||||
bucket.random_node.port - LIBTORRENT_PORT_OFFSET);
|
bucket.random_node.port - LIBTORRENT_PORT_OFFSET);
|
||||||
@ -507,8 +514,10 @@ void ThreadSessionAlerts()
|
|||||||
alert_manager *am = (*mi).second;
|
alert_manager *am = (*mi).second;
|
||||||
am->post_alert(*rd);
|
am->post_alert(*rd);
|
||||||
} else {
|
} 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",
|
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() );
|
n->string().c_str(), r->string().c_str(), t->string().c_str() );
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user