From fdb08e9ca088ef4895ad537986c3fa90894ecaf7 Mon Sep 17 00:00:00 2001 From: Miguel Freitas Date: Fri, 11 Apr 2014 18:26:39 -0300 Subject: [PATCH] make debug.log less verbose by default --- libtorrent/src/session_impl.cpp | 4 +++- src/twister.cpp | 12 +++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/libtorrent/src/session_impl.cpp b/libtorrent/src/session_impl.cpp index b2cf68b4..be204333 100644 --- a/libtorrent/src/session_impl.cpp +++ b/libtorrent/src/session_impl.cpp @@ -2747,7 +2747,7 @@ retry: if (m_paused) { #if defined(TORRENT_VERBOSE_LOGGING) || defined(TORRENT_LOGGING) - session_log(" <== INCOMING CONNECTION [ ignored, paused ]"); + //session_log(" <== INCOMING CONNECTION [ ignored, paused ]"); #endif return; } @@ -2768,10 +2768,12 @@ retry: TORRENT_ASSERT(endp.address() != address_v4::any()); +/* #if defined(TORRENT_VERBOSE_LOGGING) || defined(TORRENT_LOGGING) session_log(" <== INCOMING CONNECTION %s type: %s" , print_endpoint(endp).c_str(), s->type_name()); #endif +*/ if (m_alerts.should_post()) { diff --git a/src/twister.cpp b/src/twister.cpp index 9abd16fa..adedb34f 100644 --- a/src/twister.cpp +++ b/src/twister.cpp @@ -39,6 +39,7 @@ twister::twister() #define DEBUG_ACCEPT_POST 1 //#define DEBUG_EXPIRE_DHT_ITEM 1 //#define DEBUG_MAINTAIN_DHT_NODES 1 +//#define DEBUG_NEIGHBOR_TORRENT 1 using namespace libtorrent; static session *ses = NULL; @@ -616,11 +617,12 @@ void ThreadSessionAlerts() } if( !knownTorrent ) { if( !neighborCheck.count(ih) ) { +#if DEBUG_NEIGHBOR_TORRENT printf("possiblyNeighbor of [%s,%s,%s] - starting a new dhtget to be sure\n", n->string().c_str(), r->string().c_str(), t->string().c_str()); - +#endif neighborCheck[ih] = false; ses->dht_getData(n->string(), r->string(), t->string() == "m"); } else if( neighborCheck[ih] ) { @@ -628,9 +630,10 @@ void ThreadSessionAlerts() if( !statusCheck.count(ihStatus) || statusCheck[ihStatus] + 3600 < GetTime() ) { +#if DEBUG_NEIGHBOR_TORRENT printf("known neighbor. starting a new dhtget check of [%s,%s,%s]\n", n->string().c_str(), "status", "s"); - +#endif statusCheck[ihStatus] = GetTime(); ses->dht_getData(n->string(), "status", false); } @@ -647,10 +650,11 @@ void ThreadSessionAlerts() dht_reply_data_done_alert const* dd = alert_cast(*i); if (dd) { +#if DEBUG_NEIGHBOR_TORRENT printf("get_data_done [%s,%s,%s] is_neighbor=%d got_data=%d\n", dd->m_username.c_str(), dd->m_resource.c_str(), dd->m_multi ? "m" : "s", dd->m_is_neighbor, dd->m_got_data); - +#endif sha1_hash ih = dhtTargetHash(dd->m_username, dd->m_resource, dd->m_multi ? "m" : "s"); { @@ -666,8 +670,10 @@ void ThreadSessionAlerts() if( neighborCheck.count(ih) ) { neighborCheck[ih] = dd->m_is_neighbor; if( dd->m_is_neighbor && dd->m_resource == "tracker" ) { +#if DEBUG_NEIGHBOR_TORRENT printf("is neighbor. starting a new dhtget check of [%s,%s,%s]\n", dd->m_username.c_str(), "status", "s"); +#endif sha1_hash ihStatus = dhtTargetHash(dd->m_username, "status", "s"); statusCheck[ihStatus] = GetTime(); ses->dht_getData(dd->m_username, "status", false);