From d58b4dad7db52a0a23a67622e477ca4cb2f0733e Mon Sep 17 00:00:00 2001 From: csoler Date: Sun, 15 Feb 2009 20:22:34 +0000 Subject: [PATCH] suppressed some debuggign output. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1047 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- libretroshare/src/pqi/pqissl.cc | 2 +- libretroshare/src/pqi/pqistreamer.cc | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/libretroshare/src/pqi/pqissl.cc b/libretroshare/src/pqi/pqissl.cc index 0cee02366..a76bab894 100644 --- a/libretroshare/src/pqi/pqissl.cc +++ b/libretroshare/src/pqi/pqissl.cc @@ -1401,7 +1401,7 @@ int pqissl::readdata(void *data, int len) { int tmppktlen = SSL_read(ssl_connection, (void*)((unsigned long int)data+(unsigned long int)total_len), len-total_len); - std::cerr <<"pqissl: read " << tmppktlen+total_len << " bytes. expected " << len << ", still " << len-(tmppktlen+total_len) << " to read"<< std::endl ; +// std::cerr <<"pqissl: read " << tmppktlen+total_len << " bytes. expected " << len << ", still " << len-(tmppktlen+total_len) << " to read"<< std::endl ; // need to catch errors..... if (tmppktlen <= 0) // probably needs a reset. { diff --git a/libretroshare/src/pqi/pqistreamer.cc b/libretroshare/src/pqi/pqistreamer.cc index a19edf87b..98ad79963 100644 --- a/libretroshare/src/pqi/pqistreamer.cc +++ b/libretroshare/src/pqi/pqistreamer.cc @@ -59,6 +59,9 @@ pqistreamer::pqistreamer(RsSerialiser *rss, std::string id, BinInterface *bio_in pkt_rpend_size = getRsPktMaxSize(); pkt_rpending = malloc(pkt_rpend_size); + // avoid uninitialized (and random) memory read. + bzero(pkt_rpending,pkt_rpend_size) ; + // 100 B/s (minimal) setMaxRate(true, 0.1); setMaxRate(false, 0.1); @@ -297,6 +300,8 @@ int pqistreamer::queue_outpqi(RsItem *pqi) uint32_t pktsize = rsSerialiser->size(pqi); void *ptr = malloc(pktsize); + +// std::cerr << "serializing packet of size " << pktsize << std::endl ; if (rsSerialiser->serialise(pqi, ptr, &pktsize)) { if (isCntrl) @@ -359,6 +364,7 @@ int pqistreamer::handleoutgoing() int sentbytes = 0; int len; int ss; +// std::cerr << "pqistreamer: maxbytes=" << maxbytes<< std::endl ; std::list::iterator it; @@ -373,6 +379,7 @@ int pqistreamer::handleoutgoing() std::ostringstream out; out << "pqistreamer::handleoutgoing() Not active -> Clearing Pkt!"; +// std::cerr << out.str() ; pqioutput(PQL_DEBUG_BASIC, pqistreamerzone, out.str()); } for(it = out_data.begin(); it != out_data.end(); ) @@ -382,6 +389,7 @@ int pqistreamer::handleoutgoing() std::ostringstream out; out << "pqistreamer::handleoutgoing() Not active -> Clearing DPkt!"; +// std::cerr << out.str() ; pqioutput(PQL_DEBUG_BASIC, pqistreamerzone, out.str()); } @@ -435,6 +443,7 @@ int pqistreamer::handleoutgoing() { out << "Problems with Send Data!"; out << std::endl; + std::cerr << out.str() ; pqioutput(PQL_DEBUG_BASIC, pqistreamerzone, out.str()); outSentBytes(sentbytes); @@ -443,7 +452,8 @@ int pqistreamer::handleoutgoing() return -1; } - out << " Success!" << std::endl; + out << " Success!" << ", sent " << len << " bytes" << std::endl; +// std::cerr << out.str() ; pqioutput(PQL_DEBUG_BASIC, pqistreamerzone, out.str()); free(pkt_wpending); @@ -576,6 +586,7 @@ int pqistreamer::handleincoming() std::ostringstream out; out << "Error Completing Read (read "; out << tmplen << "/" << extralen << ")" << std::endl; +// std::cerr << out.str() ; pqioutput(PQL_ALERT, pqistreamerzone, out.str()); pqiNotify *notify = getPqiNotify(); @@ -619,9 +630,11 @@ int pqistreamer::handleincoming() std::ostringstream out; out << "Read Data Block -> Incoming Pkt("; out << blen + extralen << ")" << std::endl; +// std::cerr << out.str() ; pqioutput(PQL_DEBUG_BASIC, pqistreamerzone, out.str()); } +// std::cerr << "Deserializing packet of size " << pktlen <deserialise(block, &pktlen); if ((pkt != NULL) && (0 < handleincomingitem(pkt))) @@ -638,6 +651,7 @@ int pqistreamer::handleincoming() } } +// std::cerr << "pqistreamer:: total bytes read = " << readbytes << std::endl ; inReadBytes(readbytes); return 0; }