mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-02 22:25:04 -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
2 changed files with 19 additions and 5 deletions
|
@ -145,15 +145,24 @@ int UdpBitDht::status(std::ostream &out)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*** Overloaded from iThread ***/
|
/*** 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()
|
void UdpBitDht::run()
|
||||||
{
|
{
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
tick();
|
while(tick())
|
||||||
|
{
|
||||||
|
usleep(TICK_PAUSE_USEC);
|
||||||
|
}
|
||||||
|
|
||||||
|
mBitDhtManager->iteration();
|
||||||
sleep(1);
|
sleep(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int UdpBitDht::tick()
|
int UdpBitDht::tick()
|
||||||
{
|
{
|
||||||
bdStackMutex stack(dhtMtx); /********** MUTEX LOCKED *************/
|
bdStackMutex stack(dhtMtx); /********** MUTEX LOCKED *************/
|
||||||
|
@ -164,8 +173,7 @@ int UdpBitDht::tick()
|
||||||
struct sockaddr_in toAddr;
|
struct sockaddr_in toAddr;
|
||||||
int size = BITDHT_MAX_PKTSIZE;
|
int size = BITDHT_MAX_PKTSIZE;
|
||||||
|
|
||||||
/* accept up to 10 msgs / tick() */
|
while((i < MAX_MSG_PER_TICK) && (mBitDhtManager->outgoingMsg(&toAddr, data, &size)))
|
||||||
while((i < 10) && (mBitDhtManager->outgoingMsg(&toAddr, data, &size)))
|
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_UDP_BITDHT
|
#ifdef DEBUG_UDP_BITDHT
|
||||||
std::cerr << "UdpBitDht::tick() outgoing msg(" << size << ") to " << toAddr;
|
std::cerr << "UdpBitDht::tick() outgoing msg(" << size << ") to " << toAddr;
|
||||||
|
@ -179,8 +187,11 @@ int UdpBitDht::tick()
|
||||||
size = BITDHT_MAX_PKTSIZE; // reset msg size!
|
size = BITDHT_MAX_PKTSIZE; // reset msg size!
|
||||||
}
|
}
|
||||||
|
|
||||||
mBitDhtManager->iteration();
|
if (i == MAX_MSG_PER_TICK)
|
||||||
return 1;
|
{
|
||||||
|
return 1; /* keep on ticking */
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,9 @@ UdpStack::UdpStack(struct sockaddr_in &local)
|
||||||
|
|
||||||
bool UdpStack::resetAddress(struct sockaddr_in &local)
|
bool UdpStack::resetAddress(struct sockaddr_in &local)
|
||||||
{
|
{
|
||||||
|
std::cerr << "UdpStack::resetAddress(" << local << ")";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
return udpLayer->reset(local);
|
return udpLayer->reset(local);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue