From 720322912643abe9c0b89c93c2ac93a40894f3d4 Mon Sep 17 00:00:00 2001 From: drbob Date: Sat, 13 Nov 2010 11:46:17 +0000 Subject: [PATCH] Cleaned up Transfer debug, now that we've found the windows bug. * new uniform #define DEBUG_TRANSFERS to switch on packet timings. * switched off by default. * enabled BinData printing again. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3785 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- libretroshare/src/ft/ftfileprovider.cc | 3 +-- libretroshare/src/ft/fttransfermodule.cc | 2 -- libretroshare/src/pqi/pqistreamer.cc | 14 +++++++------- libretroshare/src/serialiser/rsbaseitems.cc | 14 +++++++------- libretroshare/src/serialiser/rstlvtypes.cc | 4 +--- 5 files changed, 16 insertions(+), 21 deletions(-) diff --git a/libretroshare/src/ft/ftfileprovider.cc b/libretroshare/src/ft/ftfileprovider.cc index 62b54f658..a34262e1d 100644 --- a/libretroshare/src/ft/ftfileprovider.cc +++ b/libretroshare/src/ft/ftfileprovider.cc @@ -11,10 +11,9 @@ /******** * #define DEBUG_FT_FILE_PROVIDER 1 +* #define DEBUG_TRANSFERS 1 // TO GET TIMESTAMPS of DATA READING ********/ -/***** TO GET TIMESTAMPS of DATA READING ****/ -#define DEBUG_TRANSFERS 1 #ifdef DEBUG_TRANSFERS #include "util/rsprint.h" diff --git a/libretroshare/src/ft/fttransfermodule.cc b/libretroshare/src/ft/fttransfermodule.cc index a782a69cd..f3cffa9da 100644 --- a/libretroshare/src/ft/fttransfermodule.cc +++ b/libretroshare/src/ft/fttransfermodule.cc @@ -27,8 +27,6 @@ * #define FT_DEBUG 1 *****/ -#define FT_DEBUG 1 - #include "retroshare/rsturtle.h" #include "fttransfermodule.h" diff --git a/libretroshare/src/pqi/pqistreamer.cc b/libretroshare/src/pqi/pqistreamer.cc index c7de27dba..8596b1284 100644 --- a/libretroshare/src/pqi/pqistreamer.cc +++ b/libretroshare/src/pqi/pqistreamer.cc @@ -43,11 +43,11 @@ const int PQISTREAM_ABS_MAX = 100000000; /* 100 MB/sec (actually per loop) */ /* This removes the print statements (which hammer pqidebug) */ /*** #define RSITEM_DEBUG 1 +#define DEBUG_TRANSFERS 1 ***/ -#define DEBUG_TRANSFER 1 -#ifdef DEBUG_TRANSFER +#ifdef DEBUG_TRANSFERS #include "util/rsprint.h" #endif @@ -458,7 +458,7 @@ int pqistreamer::handleoutgoing() if ((!(bio->cansend())) || (maxbytes < sentbytes)) { -#ifdef DEBUG_TRANSFER +#ifdef DEBUG_TRANSFERS if (maxbytes < sentbytes) { std::cerr << "pqistreamer::handleoutgoing() Stopped sending sentbytes > maxbytes. Sent " << sentbytes << " bytes "; @@ -483,7 +483,7 @@ int pqistreamer::handleoutgoing() { pkt_wpending = *(out_pkt.begin()); out_pkt.pop_front(); -#ifdef DEBUG_TRANSFER +#ifdef DEBUG_TRANSFERS std::cerr << "pqistreamer::handleoutgoing() getting next pkt from out_pkt queue"; std::cerr << std::endl; #endif @@ -493,7 +493,7 @@ int pqistreamer::handleoutgoing() { pkt_wpending = *(out_data.begin()); out_data.pop_front(); -#ifdef DEBUG_TRANSFER +#ifdef DEBUG_TRANSFERS std::cerr << "pqistreamer::handleoutgoing() getting next pkt from out_data queue"; std::cerr << std::endl; #endif @@ -523,7 +523,7 @@ int pqistreamer::handleoutgoing() return -1; } -#ifdef DEBUG_TRANSFER +#ifdef DEBUG_TRANSFERS std::cerr << "pqistreamer::handleoutgoing() Sent Packet len: " << len << " @ " << RsUtil::AccurateTimeString(); std::cerr << std::endl; #endif @@ -820,7 +820,7 @@ continue_packet: if(maxin > readbytes && bio->moretoread()) goto start_packet_read ; -#ifdef DEBUG_TRANSFER +#ifdef DEBUG_TRANSFERS if (readbytes >= maxin) { std::cerr << "pqistreamer::handleincoming() Stopped reading as readbytes >= maxin. Read " << readbytes << " bytes "; diff --git a/libretroshare/src/serialiser/rsbaseitems.cc b/libretroshare/src/serialiser/rsbaseitems.cc index f5f4bea9f..d98a0fba4 100644 --- a/libretroshare/src/serialiser/rsbaseitems.cc +++ b/libretroshare/src/serialiser/rsbaseitems.cc @@ -29,12 +29,12 @@ #include "serialiser/rstlvbase.h" /*** -#define RSSERIAL_DEBUG 1 + * #define RSSERIAL_DEBUG 1 + * #define DEBUG_TRANSFERS 1 ***/ -#define TRANSFER_DEBUG 1 -#ifdef TRANSFER_DEBUG +#ifdef DEBUG_TRANSFERS #include "util/rsprint.h" #endif @@ -232,7 +232,7 @@ bool RsFileItemSerialiser::serialiseReq(RsFileRequest *item, void *data, uin * print timestamp, and file details so we can workout packet lags. ***/ -#ifdef TRANSFER_DEBUG +#ifdef DEBUG_TRANSFERS std::cerr << "RsFileItemSerialiser::serialiseReq() at: " << RsUtil::AccurateTimeString() << std::endl; item->print(std::cerr, 10); #endif @@ -295,7 +295,7 @@ RsFileRequest *RsFileItemSerialiser::deserialiseReq(void *data, uint32_t *pktsiz * print timestamp, and file details so we can workout packet lags. ***/ -#ifdef TRANSFER_DEBUG +#ifdef DEBUG_TRANSFERS std::cerr << "RsFileItemSerialiser::deserialiseReq() at: " << RsUtil::AccurateTimeString() << std::endl; item->print(std::cerr, 10); #endif @@ -404,7 +404,7 @@ bool RsFileItemSerialiser::serialiseData(RsFileData *item, void *data, uint3 #endif } -#ifdef TRANSFER_DEBUG +#ifdef DEBUG_TRANSFERS std::cerr << "RsFileItemSerialiser::serialiseData() at: " << RsUtil::AccurateTimeString() << std::endl; item->print(std::cerr, 10); #endif @@ -460,7 +460,7 @@ RsFileData *RsFileItemSerialiser::deserialiseData(void *data, uint32_t *pktsize) return NULL; } -#ifdef TRANSFER_DEBUG +#ifdef DEBUG_TRANSFERS std::cerr << "RsFileItemSerialiser::deserialiseData() at: " << RsUtil::AccurateTimeString() << std::endl; item->print(std::cerr, 10); #endif diff --git a/libretroshare/src/serialiser/rstlvtypes.cc b/libretroshare/src/serialiser/rstlvtypes.cc index 76cc5c00f..c1fe805e5 100644 --- a/libretroshare/src/serialiser/rstlvtypes.cc +++ b/libretroshare/src/serialiser/rstlvtypes.cc @@ -213,7 +213,6 @@ std::ostream &RsTlvBinaryData::print(std::ostream &out, uint16_t indent) sout << "RsTlvBinaryData: Type: " << tlvtype << " Size: " << bin_len; sout << std::hex; -#if 0 for(i = 0; i < bin_len; i++) { if (i % 16 == 0) @@ -224,9 +223,8 @@ std::ostream &RsTlvBinaryData::print(std::ostream &out, uint16_t indent) sout << std::setw(2) << std::setfill('0') << (int) (((unsigned char *) bin_data)[i]) << ":"; } -#endif - sout << std::endl; + sout << std::endl; out << sout.str(); printEnd(out, "RsTlvBinaryData", indent);