* BUGFIX: enabled more than 10 outgoing msgs for the DHT. (max 5000 / sec now)

* Added debug message when the udp port changes.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3561 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2010-09-29 20:02:39 +00:00
parent b690f933c1
commit aa46ed0f69
2 changed files with 19 additions and 5 deletions

View File

@ -145,15 +145,24 @@ int UdpBitDht::status(std::ostream &out)
}
/*** Overloaded from iThread ***/
#define MAX_MSG_PER_TICK 100
#define TICK_PAUSE_USEC 20000 /* 20ms secs .. max messages = 50 x 100 = 5000 */
void UdpBitDht::run()
{
while(1)
{
tick();
while(tick())
{
usleep(TICK_PAUSE_USEC);
}
mBitDhtManager->iteration();
sleep(1);
}
}
int UdpBitDht::tick()
{
bdStackMutex stack(dhtMtx); /********** MUTEX LOCKED *************/
@ -164,8 +173,7 @@ int UdpBitDht::tick()
struct sockaddr_in toAddr;
int size = BITDHT_MAX_PKTSIZE;
/* accept up to 10 msgs / tick() */
while((i < 10) && (mBitDhtManager->outgoingMsg(&toAddr, data, &size)))
while((i < MAX_MSG_PER_TICK) && (mBitDhtManager->outgoingMsg(&toAddr, data, &size)))
{
#ifdef DEBUG_UDP_BITDHT
std::cerr << "UdpBitDht::tick() outgoing msg(" << size << ") to " << toAddr;
@ -179,8 +187,11 @@ int UdpBitDht::tick()
size = BITDHT_MAX_PKTSIZE; // reset msg size!
}
mBitDhtManager->iteration();
return 1;
if (i == MAX_MSG_PER_TICK)
{
return 1; /* keep on ticking */
}
return 0;
}

View File

@ -49,6 +49,9 @@ UdpStack::UdpStack(struct sockaddr_in &local)
bool UdpStack::resetAddress(struct sockaddr_in &local)
{
std::cerr << "UdpStack::resetAddress(" << local << ")";
std::cerr << std::endl;
return udpLayer->reset(local);
}