mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-22 22:21:09 -04:00
Added a thread per active peer - to reduce RTT and increase throughout.
* Added pqithreadstreamer, tweaked pqistreamer to support derivation. * Shifted RTT from p3Service to p3FastService. * Disabled lots of debug. git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.6-initdev@6787 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
a7dd9ad9e3
commit
b587301b5a
22 changed files with 658 additions and 1414 deletions
File diff suppressed because it is too large
Load diff
|
@ -118,7 +118,7 @@ static double convert64bitsToTs(uint64_t bits)
|
|||
|
||||
|
||||
p3rtt::p3rtt(p3LinkMgr *lm)
|
||||
:p3Service(RS_SERVICE_TYPE_RTT), /* p3Config(CONFIG_TYPE_RTT), */ mRttMtx("p3rtt"), mLinkMgr(lm)
|
||||
:p3FastService(RS_SERVICE_TYPE_RTT), mRttMtx("p3rtt"), mLinkMgr(lm)
|
||||
{
|
||||
addSerialType(new RsRttSerialiser());
|
||||
|
||||
|
@ -130,7 +130,6 @@ p3rtt::p3rtt(p3LinkMgr *lm)
|
|||
|
||||
int p3rtt::tick()
|
||||
{
|
||||
processIncoming();
|
||||
sendPackets();
|
||||
|
||||
return 0;
|
||||
|
@ -212,57 +211,30 @@ void p3rtt::sendPingMeasurements()
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int p3rtt::processIncoming()
|
||||
bool p3rtt::recvItem(RsItem *item)
|
||||
{
|
||||
/* for each packet - pass to specific handler */
|
||||
RsItem *item = NULL;
|
||||
while(NULL != (item = recvItem()))
|
||||
switch(item->PacketSubType())
|
||||
{
|
||||
switch(item->PacketSubType())
|
||||
default:
|
||||
break;
|
||||
case RS_PKT_SUBTYPE_RTT_PING:
|
||||
{
|
||||
default:
|
||||
break;
|
||||
case RS_PKT_SUBTYPE_RTT_PING:
|
||||
{
|
||||
handlePing(item);
|
||||
}
|
||||
break;
|
||||
case RS_PKT_SUBTYPE_RTT_PONG:
|
||||
{
|
||||
handlePong(item);
|
||||
}
|
||||
break;
|
||||
|
||||
#if 0
|
||||
/* THESE ARE ALL FUTURISTIC DATA TYPES */
|
||||
case RS_DATA_ITEM:
|
||||
{
|
||||
handleData(item);
|
||||
}
|
||||
break;
|
||||
|
||||
case RS_BANDWIDTH_PING_ITEM:
|
||||
{
|
||||
handleBandwidthPing(item);
|
||||
}
|
||||
break;
|
||||
|
||||
case RS_BANDWIDTH_PONG_ITEM:
|
||||
{
|
||||
handleBandwidthPong(item);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
handlePing(item);
|
||||
}
|
||||
|
||||
/* clean up */
|
||||
delete item;
|
||||
break;
|
||||
case RS_PKT_SUBTYPE_RTT_PONG:
|
||||
{
|
||||
handlePong(item);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
/* clean up */
|
||||
delete item;
|
||||
return true ;
|
||||
}
|
||||
|
||||
|
||||
int p3rtt::handlePing(RsItem *item)
|
||||
{
|
||||
/* cast to right type */
|
||||
|
|
|
@ -60,7 +60,7 @@ class RttPeerInfo
|
|||
* Used to test Latency.
|
||||
*/
|
||||
|
||||
class p3rtt: public RsRtt, public p3Service
|
||||
class p3rtt: public RsRtt, public p3FastService
|
||||
{
|
||||
public:
|
||||
p3rtt(p3LinkMgr *cm);
|
||||
|
@ -74,10 +74,10 @@ virtual uint32_t getPongResults(std::string id, int n, std::list<RsRttPongResult
|
|||
virtual int tick();
|
||||
virtual int status();
|
||||
|
||||
|
||||
int sendPackets();
|
||||
void sendPingMeasurements();
|
||||
int processIncoming();
|
||||
|
||||
virtual bool recvItem(RsItem *item); // Overloaded from p3FastService.
|
||||
|
||||
int handlePing(RsItem *item);
|
||||
int handlePong(RsItem *item);
|
||||
|
|
|
@ -67,6 +67,7 @@ bool p3Service::recvItem(RsItem *item)
|
|||
|
||||
recv_queue.push_back(item);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue