From 0a943ea9ee85213aed0c103716d57a0da35fd178 Mon Sep 17 00:00:00 2001 From: RetroPooh Date: Sun, 1 Apr 2018 17:26:48 +0300 Subject: [PATCH] log shut up --- libretroshare/src/pqi/p3linkmgr.cc | 8 +++++++- libretroshare/src/pqi/p3peermgr.cc | 4 +++- libretroshare/src/pqi/pqipersongrp.cc | 3 +++ libretroshare/src/pqi/pqissl.cc | 11 +++++++++++ libretroshare/src/pqi/pqisslproxy.cc | 7 +++++-- 5 files changed, 29 insertions(+), 4 deletions(-) diff --git a/libretroshare/src/pqi/p3linkmgr.cc b/libretroshare/src/pqi/p3linkmgr.cc index c84b8ea4f..6c839d268 100644 --- a/libretroshare/src/pqi/p3linkmgr.cc +++ b/libretroshare/src/pqi/p3linkmgr.cc @@ -56,6 +56,7 @@ static struct RsLog::logInfo p3connectzoneInfo = {RsLog::Default, "p3connect"}; /**** * #define LINKMGR_DEBUG 1 + * #define LINKMGR_DEBUG_LOG 1 * #define LINKMGR_DEBUG_CONNFAIL 1 * #define LINKMGR_DEBUG_ACTIONS 1 * #define LINKMGR_DEBUG_LINKTYPE 1 @@ -620,7 +621,9 @@ bool p3LinkMgrIMPL::connectAttempt(const RsPeerId &id, struct sockaddr_storage & } +#ifdef LINKMGR_DEBUG_LOG rslog(RSL_WARNING, p3connectzone, "p3LinkMgrIMPL::connectAttempt() called id: " + id.toStdString()); +#endif it->second.lastattempt = time(NULL); it->second.inConnAttempt = true; @@ -823,7 +826,9 @@ bool p3LinkMgrIMPL::connectResult(const RsPeerId &id, bool success, bool isIncom out += " FAILED ATTEMPT (Not Connected)"; } } +#ifdef LINKMGR_DEBUG_LOG rslog(RSL_WARNING, p3connectzone, out); +#endif } @@ -2057,8 +2062,9 @@ bool p3LinkMgrIMPL::locked_ConnectAttempt_Complete(peerConnectState *peer) int p3LinkMgrIMPL::addFriend(const RsPeerId &id, bool isVisible) { +#ifdef LINKMGR_DEBUG_LOG rslog(RSL_WARNING, p3connectzone, "p3LinkMgr::addFriend() id: " + id.toStdString()); - +#endif { RsStackMutex stack(mLinkMtx); /****** STACK LOCK MUTEX *******/ diff --git a/libretroshare/src/pqi/p3peermgr.cc b/libretroshare/src/pqi/p3peermgr.cc index 9862838aa..0d1562b41 100644 --- a/libretroshare/src/pqi/p3peermgr.cc +++ b/libretroshare/src/pqi/p3peermgr.cc @@ -69,6 +69,7 @@ static struct RsLog::logInfo p3peermgrzoneInfo = {RsLog::Default, "p3peermgr"}; /**** * #define PEER_DEBUG 1 + * #define PEER_DEBUG_LOG 1 ***/ #define MAX_AVAIL_PERIOD 230 //times a peer stay in available state when not connected @@ -910,8 +911,9 @@ bool p3PeerMgrIMPL::addFriend(const RsPeerId& input_id, const RsPgpId& input_gpg RsPeerId id = input_id ; RsPgpId gpg_id = input_gpg_id ; +#ifdef PEER_DEBUG_LOG rslog(RSL_WARNING, p3peermgrzone, "p3PeerMgr::addFriend() id: " + id.toStdString()); - +#endif { RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/ diff --git a/libretroshare/src/pqi/pqipersongrp.cc b/libretroshare/src/pqi/pqipersongrp.cc index a8afa2b84..3df48fdb3 100644 --- a/libretroshare/src/pqi/pqipersongrp.cc +++ b/libretroshare/src/pqi/pqipersongrp.cc @@ -45,6 +45,7 @@ static std::list waitingIds; /**** *#define PGRP_DEBUG 1 + *#define PGRP_DEBUG_LOG 1 ****/ #define DEFAULT_DOWNLOAD_KB_RATE (200.0) @@ -420,7 +421,9 @@ int pqipersongrp::addPeer(const RsPeerId& id) sm -> pqi = pqip; // reset it to start it working. +#ifdef PGRP_DEBUG_LOG pqioutput(PQL_WARNING, pqipersongrpzone, "pqipersongrp::addPeer() => reset() called to initialise new person"); +#endif pqip -> reset(); pqip -> listen(); diff --git a/libretroshare/src/pqi/pqissl.cc b/libretroshare/src/pqi/pqissl.cc index 898080262..41c8a523e 100644 --- a/libretroshare/src/pqi/pqissl.cc +++ b/libretroshare/src/pqi/pqissl.cc @@ -61,6 +61,7 @@ static struct RsLog::logInfo pqisslzoneInfo = {RsLog::Default, "pqisslzone"}; #define PQISSL_DEBUG 1 #define PQISSL_LOG_DEBUG 1 +#define PQISSL_LOG_DEBUG2 1 const int PQISSL_LOCAL_FLAG = 0x01; const int PQISSL_REMOTE_FLAG = 0x02; @@ -269,7 +270,9 @@ int pqissl::reset_locked() #endif } +#ifdef PQISSL_LOG_DEBUG2 rslog(RSL_ALERT, pqisslzone, outLog); +#endif // notify people of problem! // but only if we really shut something down. @@ -678,7 +681,9 @@ int pqissl::Initiate_Connection() std::string out; rs_sprintf(out, "pqissl::Initiate_Connection() Connecting To: %s via: ", PeerId().toStdString().c_str()); out += sockaddr_storage_tostring(addr); +#ifdef PQISSL_LOG_DEBUG2 rslog(RSL_WARNING, pqisslzone, out); +#endif } if (sockaddr_storage_isnull(addr)) @@ -832,10 +837,14 @@ bool pqissl::CheckConnectionTimeout() std::string out; rs_sprintf(out, "pqissl::Basic_Connection_Complete() Connection Timed Out. Peer: %s Period: %lu", PeerId().toStdString().c_str(), mConnectTimeout); +#ifdef PQISSL_LOG_DEBUG2 rslog(RSL_WARNING, pqisslzone, out); +#endif /* as sockfd is valid, this should close it all up */ +#ifdef PQISSL_LOG_DEBUG2 rslog(RSL_ALERT, pqisslzone, "pqissl::Basic_Connection_Complete() -> calling reset()"); +#endif reset_locked(); return true; } @@ -974,7 +983,9 @@ int pqissl::Basic_Connection_Complete() { std::string out; rs_sprintf(out, "pqissl::Basic_Connection_Complete() TCP Connection Complete: cert: %s on osock: ", PeerId().toStdString().c_str(), sockfd); +#ifdef PQISSL_LOG_DEBUG2 rslog(RSL_WARNING, pqisslzone, out); +#endif } return 1; } diff --git a/libretroshare/src/pqi/pqisslproxy.cc b/libretroshare/src/pqi/pqisslproxy.cc index 90444bcf9..500c6a7d8 100644 --- a/libretroshare/src/pqi/pqisslproxy.cc +++ b/libretroshare/src/pqi/pqisslproxy.cc @@ -42,6 +42,7 @@ static struct RsLog::logInfo pqisslproxyzoneInfo = {RsLog::Default, "pqisslproxy #define pqisslproxyzone &pqisslproxyzoneInfo // #define PROXY_DEBUG 1 +// #define PROXY_DEBUG_LOG 1 #define PROXY_STATE_FAILED 0 #define PROXY_STATE_INIT 1 @@ -593,8 +594,9 @@ bool pqisslproxy::connect_parameter(uint32_t type, const std::string &value) { std::string out; rs_sprintf(out, "pqisslproxy::connect_parameter() Peer: %s DOMAIN_ADDRESS: %s", PeerId().toStdString().c_str(), value.c_str()); +#ifdef PROXY_DEBUG_LOG rslog(RSL_WARNING, pqisslproxyzone, out); - +#endif mDomainAddress = value; #ifdef PROXY_DEBUG std::cerr << out << std::endl; @@ -615,8 +617,9 @@ bool pqisslproxy::connect_parameter(uint32_t type, uint32_t value) { std::string out; rs_sprintf(out, "pqisslproxy::connect_parameter() Peer: %s REMOTE_PORT: %lu", PeerId().toStdString().c_str(), value); +#ifdef PROXY_DEBUG_LOG rslog(RSL_WARNING, pqisslproxyzone, out); - +#endif mRemotePort = value; #ifdef PROXY_DEBUG std::cerr << out << std::endl;