mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
* 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:
parent
b690f933c1
commit
aa46ed0f69
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user