mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-12 00:23:08 -04:00
Merged Changes /branches/v0.5-peernet/libretroshare/:r4237-4358
Major changes are: * Improvements to tcponudp library to allow multiple UdpStacks / ports, with alternative recievers. * Resurrected the UdpStunner code, and improved it. * Added UdpRelay code. * Modified startup code and ssludp code to use the new tcponudp and add a stunner. * fixed buggy rs_inet_ntoa * fixed a bunch of apple gcc warnings. mainly for(;;); => for(;;) ; These changes shouldn't affect libretroshare stability... those changes will follow! git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4359 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
d58f838269
commit
b683e663d6
19 changed files with 1679 additions and 151 deletions
|
@ -26,6 +26,7 @@
|
|||
#include "util/rsnet.h"
|
||||
#include "util/rsthreads.h"
|
||||
#include <string.h>
|
||||
#include <sstream>
|
||||
|
||||
#ifdef WINDOWS_SYS
|
||||
#else
|
||||
|
@ -137,14 +138,21 @@ std::ostream &operator<<(std::ostream &out, const struct sockaddr_in &addr)
|
|||
}
|
||||
|
||||
/* thread-safe version of inet_ntoa */
|
||||
|
||||
static RsMutex inetMtx;
|
||||
/*** XXX, PROBLEM this function is not Thread-Safe.
|
||||
* because it can be called in lots of other parts of the program.
|
||||
* which could still collide with this one!
|
||||
*
|
||||
* Must rewrite to make truely thread-safe.
|
||||
*/
|
||||
|
||||
std::string rs_inet_ntoa(struct in_addr in)
|
||||
{
|
||||
RsStackMutex stack(inetMtx);
|
||||
|
||||
std::string addr(inet_ntoa(in));
|
||||
return addr;
|
||||
std::ostringstream str;
|
||||
uint8_t *bytes = (uint8_t *) &(in.s_addr);
|
||||
str << (int) bytes[0] << ".";
|
||||
str << (int) bytes[1] << ".";
|
||||
str << (int) bytes[2] << ".";
|
||||
str << (int) bytes[3];
|
||||
return str.str();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue