mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-11 10:35:22 -04:00
Merged from /branches/v0.5-peernet/libbitdht:r4357-4397
Bugfixes and a couple of small improvements to the DHT code. * fixed up buggy overloading for the udplayer (for testing). * added processing multiple (5) remote processes per tick. - (1 wasn't enough in testing, and led to dropped peers) * removed unused variables from query data structure. * #defined out debugging in bdSpace, removed old functions. * More agressive attempts to find proxies for connections. * made "final query attempt" use exact peer address rather than midid. - mid id meant that the target wasn't always returned. * tweaked bdconnection debugging. * increase CONNECTION_MAX_TIMEOUT from 30 => 45. wasn't enough! * Limited bdQuery::QueryIdlePeriod to 15min (was unlimited). * added bdQuery::PotentialPeer cleanup functions - for more robust reporting. * fixed bdQuery debugging printouts. * Implemented BITDHT_QFLAGS_UPDATES flag. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4398 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
24351cb460
commit
5e691935fd
14 changed files with 202 additions and 131 deletions
|
@ -539,7 +539,7 @@ int LossyUdpLayer::receiveUdpPacket(void *data, int *size, struct sockaddr_in &f
|
|||
std::cerr << "LossyUdpLayer::receiveUdpPacket() Packet Dropped!";
|
||||
std::cerr << std::endl;
|
||||
|
||||
size = 0;
|
||||
*size = 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -548,7 +548,7 @@ int LossyUdpLayer::receiveUdpPacket(void *data, int *size, struct sockaddr_in &f
|
|||
return -1;
|
||||
}
|
||||
|
||||
int LossyUdpLayer::sendUdpPacket(const void *data, int size, struct sockaddr_in &to)
|
||||
int LossyUdpLayer::sendUdpPacket(const void *data, int size, const struct sockaddr_in &to)
|
||||
{
|
||||
double prob = (1.0 * (rand() / (RAND_MAX + 1.0)));
|
||||
|
||||
|
@ -625,19 +625,25 @@ int RestrictedUdpLayer::receiveUdpPacket(void *data, int *size, struct sockaddr_
|
|||
//std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
size = 0;
|
||||
*size = 0;
|
||||
return -1;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#ifdef DEBUG_UDP_LAYER
|
||||
std::cerr << "RestrictedUdpLayer::receiveUdpPacket() Accepting packet";
|
||||
std::cerr << ", Port(" << inPort << ") in Okay range!";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
/* acceptable port */
|
||||
return *size;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int RestrictedUdpLayer::sendUdpPacket(const void *data, int size, struct sockaddr_in &to)
|
||||
int RestrictedUdpLayer::sendUdpPacket(const void *data, int size, const struct sockaddr_in &to)
|
||||
{
|
||||
/* check the port against list */
|
||||
uint16_t outPort = ntohs(to.sin_port);
|
||||
|
@ -661,6 +667,12 @@ int RestrictedUdpLayer::sendUdpPacket(const void *data, int size, struct sockadd
|
|||
|
||||
|
||||
}
|
||||
|
||||
#ifdef DEBUG_UDP_LAYER
|
||||
std::cerr << "RestrictedUdpLayer::sendUdpPacket() Sending packet";
|
||||
std::cerr << ", Port(" << outPort << ") in Okay range!";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
// otherwise read normally;
|
||||
return UdpLayer::sendUdpPacket(data, size, to);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue