diff --git a/libretroshare/src/pqi/pqihandler.cc b/libretroshare/src/pqi/pqihandler.cc index 6cd94b278..684a773df 100644 --- a/libretroshare/src/pqi/pqihandler.cc +++ b/libretroshare/src/pqi/pqihandler.cc @@ -32,6 +32,10 @@ #include "pqi/pqidebug.h" const int pqihandlerzone = 34283; +/**** +#define DEBUG_TICK 1 +#define RSITEM_DEBUG 1 +****/ pqihandler::pqihandler(SecurityPolicy *Global) { @@ -65,12 +69,18 @@ int pqihandler::tick() { if (0 < ((it -> second) -> pqi) -> tick()) { +#ifdef DEBUG_TICK + std::cerr << "pqihandler::tick() moreToTick from mod()" << std::endl; +#endif moreToTick = 1; } } // get the items, and queue them correctly if (0 < GetItems()) { +#ifdef DEBUG_TICK + std::cerr << "pqihandler::tick() moreToTick from GetItems()" << std::endl; +#endif moreToTick = 1; } @@ -303,6 +313,7 @@ int pqihandler::GetItems() // if yes... attempt to read. while((item = (mod -> pqi) -> GetItem()) != NULL) { +#ifdef RSITEM_DEBUG std::ostringstream out; out << "pqihandler::GetItems() Incoming Item "; out << " from: " << mod -> pqi << std::endl; @@ -310,6 +321,7 @@ int pqihandler::GetItems() pqioutput(PQL_DEBUG_BASIC, pqihandlerzone, out.str()); +#endif if (item->PeerId() != (mod->pqi)->PeerId()) { diff --git a/libretroshare/src/pqi/pqipersongrp.cc b/libretroshare/src/pqi/pqipersongrp.cc index 27fb71297..b09e3ddc5 100644 --- a/libretroshare/src/pqi/pqipersongrp.cc +++ b/libretroshare/src/pqi/pqipersongrp.cc @@ -31,6 +31,9 @@ const int pqipersongrpzone = 354; +/**** +#define DEBUG_TICK 1 +****/ // handle the tunnel services. int pqipersongrp::tickServiceRecv() @@ -108,13 +111,32 @@ int pqipersongrp::tick() } int i = 0; - if (tickServiceSend()) i = 1; + if (tickServiceSend()) + { + i = 1; +#ifdef DEBUG_TICK + std::cerr << "pqipersongrp::tick() moreToTick from tickServiceSend()" << std::endl; +#endif + } - if (pqihandler::tick()) i = 1; /* does actual Send/Recv */ + if (pqihandler::tick()) /* does actual Send/Recv */ + { + i = 1; +#ifdef DEBUG_TICK + std::cerr << "pqipersongrp::tick() moreToTick from pqihandler::tick()" << std::endl; +#endif + } - if (tickServiceRecv()) i = 1; - return 1; + if (tickServiceRecv()) + { + i = 1; +#ifdef DEBUG_TICK + std::cerr << "pqipersongrp::tick() moreToTick from tickServiceRecv()" << std::endl; +#endif + } + + return i; } int pqipersongrp::status() diff --git a/libretroshare/src/pqi/pqistreamer.cc b/libretroshare/src/pqi/pqistreamer.cc index 5f47da552..b4e777855 100644 --- a/libretroshare/src/pqi/pqistreamer.cc +++ b/libretroshare/src/pqi/pqistreamer.cc @@ -40,6 +40,12 @@ const int pqistreamerzone = 8221; const int PQISTREAM_ABS_MAX = 100000000; /* 100 MB/sec (actually per loop) */ +/* This removes the print statements (which hammer pqidebug) */ +/*** +#define RSITEM_DEBUG 1 + ***/ + + pqistreamer::pqistreamer(RsSerialiser *rss, std::string id, BinInterface *bio_in, int bio_flags_in) :PQInterface(id), rsSerialiser(rss), bio(bio_in), bio_flags(bio_flags_in), pkt_wpending(NULL), @@ -146,12 +152,14 @@ pqistreamer::~pqistreamer() // Get/Send Items. int pqistreamer::SendItem(RsItem *si) { +#ifdef RSITEM_DEBUG { std::ostringstream out; out << "pqistreamer::SendItem():" << std::endl; si -> print(out); pqioutput(PQL_DEBUG_ALL, pqistreamerzone, out.str()); } +#endif return queue_outpqi(si); } diff --git a/libretroshare/src/rsserver/p3face-server.cc b/libretroshare/src/rsserver/p3face-server.cc index c5b93f692..72311790c 100644 --- a/libretroshare/src/rsserver/p3face-server.cc +++ b/libretroshare/src/rsserver/p3face-server.cc @@ -32,6 +32,10 @@ #include #include +/**** +#define DEBUG_TICK 1 +****/ + RsServer::RsServer(RsIface &i, NotifyBase &callback) :RsControl(i, callback) { @@ -47,23 +51,6 @@ RsServer::~RsServer() ----> MUST BE LOCKED! */ -#if 0 -cert *RsServer::intFindCert(RsCertId id) -{ - certsign cs; - convert_to_certsign(id, cs); - return sslr -> findcertsign(cs); -} - -RsCertId RsServer::intGetCertId(cert *c) -{ - certsign cs; - sslr -> getcertsign(c, cs); - RsCertId id = convert_to_str(cs); - return id; -} -#endif - #ifdef WINDOWS_SYS #include #include @@ -91,7 +78,7 @@ void RsServer::run() double timeDelta = 0.25; double minTimeDelta = 0.1; // 25; - double maxTimeDelta = 2.0; + double maxTimeDelta = 1.0; double kickLimit = 0.5; double avgTickRate = timeDelta; @@ -118,17 +105,21 @@ void RsServer::run() /* for the fast ticked stuff */ if (delta > timeDelta) { - //std::cerr << "Delta: " << delta << std::endl; - //std::cerr << "Time Delta: " << timeDelta << std::endl; - //std::cerr << "Avg Tick Rate: " << avgTickRate << std::endl; +#ifdef DEBUG_TICK + std::cerr << "Delta: " << delta << std::endl; + std::cerr << "Time Delta: " << timeDelta << std::endl; + std::cerr << "Avg Tick Rate: " << avgTickRate << std::endl; +#endif lastts = ts; /******************************** RUN SERVER *****************/ lockRsCore(); - // std::cerr << "RsServer::run() Lock() -> Run()" << std::endl; int moreToTick = server -> tick(); +#ifdef DEBUG_TICK + std::cerr << "RsServer::run() server->tick(): moreToTick: " << moreToTick << std::endl; +#endif unlockRsCore(); @@ -187,7 +178,9 @@ void RsServer::run() // Update All Every 5 Seconds. // These Update Functions do the locking themselves. - //std::cerr << "RsServer::run() Updates()" << std::endl; +#ifdef DEBUG_TICK + std::cerr << "RsServer::run() Updates()" << std::endl; +#endif // These two have been completed! //std::cerr << "RsServer::run() UpdateAllCerts()" << std::endl; @@ -222,7 +215,6 @@ void RsServer::run() mRanking->tick(); - /* force saving test */ #if 0 std::string opt; std::string val = "VALUE"; @@ -262,13 +254,6 @@ void RsServer::run() } // end of slow tick. } // end of only once a second. - - // update graphics.. ( but only if gui is visible ) - // This is also triggered in slow tick... - //if ((ui->main_win->shown()) || (ui->chatter_window->shown())) - { - // update(); - } } return; } diff --git a/libretroshare/src/serialiser/rstlvtypes.cc b/libretroshare/src/serialiser/rstlvtypes.cc index f9f44dfee..6bd9660b2 100644 --- a/libretroshare/src/serialiser/rstlvtypes.cc +++ b/libretroshare/src/serialiser/rstlvtypes.cc @@ -70,6 +70,12 @@ RsTlvBinaryData::RsTlvBinaryData(uint16_t t) return; } +RsTlvBinaryData::~RsTlvBinaryData() +{ + TlvClear(); +} + + /// used to allocate memory andinitialize binary data member bool RsTlvBinaryData::setBinData(void *data, uint16_t size) { diff --git a/libretroshare/src/serialiser/rstlvtypes.h b/libretroshare/src/serialiser/rstlvtypes.h index c937b328a..8949c6d80 100644 --- a/libretroshare/src/serialiser/rstlvtypes.h +++ b/libretroshare/src/serialiser/rstlvtypes.h @@ -63,7 +63,7 @@ class RsTlvBinaryData: public RsTlvItem { public: RsTlvBinaryData(uint16_t t); - virtual ~RsTlvBinaryData() { return;} +virtual ~RsTlvBinaryData(); virtual uint16_t TlvSize(); virtual void TlvClear(); /*! Initialize fields to empty legal values ( "0", "", etc) */ /// Serialise. diff --git a/libretroshare/src/server/filedexserver.cc b/libretroshare/src/server/filedexserver.cc index 771e5df8b..bbf46557e 100644 --- a/libretroshare/src/server/filedexserver.cc +++ b/libretroshare/src/server/filedexserver.cc @@ -53,7 +53,10 @@ const int fldxsrvrzone = 47659; +/**** #define SERVER_DEBUG 1 +#define DEBUG_TICK 1 +****/ filedexserver::filedexserver() :p3Config(CONFIG_TYPE_FSERVER), @@ -100,16 +103,25 @@ int filedexserver::tick() if (0 < pqisi -> tick()) { moreToTick = 1; +#ifdef DEBUG_TICK + std::cerr << "filedexserver::tick() moreToTick from pqisi" << std::endl; +#endif } if (0 < handleInputQueues()) { moreToTick = 1; +#ifdef DEBUG_TICK + std::cerr << "filedexserver::tick() moreToTick from InputQueues" << std::endl; +#endif } if (0 < handleOutputQueues()) { moreToTick = 1; +#ifdef DEBUG_TICK + std::cerr << "filedexserver::tick() moreToTick from OutputQueues" << std::endl; +#endif } return moreToTick; }