Added TRANSFER debug to pqistreamer.

* print packet size and time - when actually sending it.
 * print reason for stopping to read or send packets.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3780 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2010-11-11 23:59:04 +00:00
parent 06273fa775
commit d649a27fd9

View File

@ -45,6 +45,12 @@ const int PQISTREAM_ABS_MAX = 100000000; /* 100 MB/sec (actually per loop) */
#define RSITEM_DEBUG 1
***/
#define DEBUG_TRANSFER 1
#ifdef DEBUG_TRANSFER
#include "util/rsprint.h"
#endif
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),
@ -451,6 +457,20 @@ int pqistreamer::handleoutgoing()
if ((!(bio->cansend())) || (maxbytes < sentbytes))
{
#ifdef DEBUG_TRANSFER
if (maxbytes < sentbytes)
{
std::cerr << "pqistreamer::handleoutgoing() Stopped sending sentbytes > maxbytes. Sent " << sentbytes << " bytes ";
std::cerr << std::endl;
}
else
{
std::cerr << "pqistreamer::handleoutgoing() Stopped sending at cansend() is false";
std::cerr << std::endl;
}
#endif
outSentBytes(sentbytes);
return 0;
}
@ -463,11 +483,20 @@ int pqistreamer::handleoutgoing()
{
pkt_wpending = *(out_pkt.begin());
out_pkt.pop_front();
#ifdef DEBUG_TRANSFER
std::cerr << "pqistreamer::handleoutgoing() getting next pkt from out_pkt queue";
std::cerr << std::endl;
#endif
}
else if (out_data.size() > 0)
{
pkt_wpending = *(out_data.begin());
out_data.pop_front();
#ifdef DEBUG_TRANSFER
std::cerr << "pqistreamer::handleoutgoing() getting next pkt from out_data queue";
std::cerr << std::endl;
#endif
}
}
@ -494,6 +523,11 @@ int pqistreamer::handleoutgoing()
return -1;
}
#ifdef DEBUG_TRANSFER
std::cerr << "pqistreamer::handleoutgoing() Sent Packet len: " << len << " @ " << RsUtil::AccurateTimeString();
std::cerr << std::endl;
#endif
// out << " Success!" << ", sent " << len << " bytes" << std::endl;
// std::cerr << out.str() ;
pqioutput(PQL_DEBUG_BASIC, pqistreamerzone, out.str());
@ -786,6 +820,14 @@ continue_packet:
if(maxin > readbytes && bio->moretoread())
goto start_packet_read ;
#ifdef DEBUG_TRANSFER
if (readbytes >= maxin)
{
std::cerr << "pqistreamer::handleincoming() Stopped reading as readbytes >= maxin. Read " << readbytes << " bytes ";
std::cerr << std::endl;
}
#endif
inReadBytes(readbytes);
return 0;
}