Found cause of OSX network resets / lost connections: inet_ntoa is not thread-safe.

* Added thread-safe rs_inet_ntoa function (util/rsnet.cc)
 * Switched all calls to this function (most of the changes)
 * Modified getLocalInterfaces() and getPreferredInterface() to avoid string conversions.
   - NB: Modified windows functions too, but unable to test (hope it compiles!)

Also:
 * Added  EVP_CIPHER_CTX_rand_key() replacement function for old versions of SSL (pre 0.9.8)  (for OSX 10.5)
   - NB: This code should be reworked to remove these calls anyway.
 * Updated tests/pqi to handle above changes.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3281 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2010-07-10 20:34:03 +00:00
parent 0b298f6ca1
commit 648e15bcf7
34 changed files with 360 additions and 235 deletions

View file

@ -786,11 +786,11 @@ std::ostream &RsPeerOldNetItem::print(std::ostream &out, uint16_t indent)
out << "lastContact: " << lastContact << std::endl;
printIndent(out, int_Indent);
out << "currentlocaladdr: " << inet_ntoa(currentlocaladdr.sin_addr);
out << "currentlocaladdr: " << rs_inet_ntoa(currentlocaladdr.sin_addr);
out << ":" << htons(currentlocaladdr.sin_port) << std::endl;
printIndent(out, int_Indent);
out << "currentremoteaddr: " << inet_ntoa(currentremoteaddr.sin_addr);
out << "currentremoteaddr: " << rs_inet_ntoa(currentremoteaddr.sin_addr);
out << ":" << htons(currentremoteaddr.sin_port) << std::endl;
printIndent(out, int_Indent);
@ -800,7 +800,7 @@ std::ostream &RsPeerOldNetItem::print(std::ostream &out, uint16_t indent)
out << "ipAdressList: size : " << ipAddressList.size() << ", adresses : " << std::endl;
for (std::list<IpAddressTimed>::iterator ipListIt = ipAddressList.begin(); ipListIt!=(ipAddressList.end()); ipListIt++) {
printIndent(out, int_Indent);
out << inet_ntoa(ipListIt->ipAddr.sin_addr) << ":" << ntohs(ipListIt->ipAddr.sin_port) << " seenTime : " << ipListIt->seenTime << std::endl;
out << rs_inet_ntoa(ipListIt->ipAddr.sin_addr) << ":" << ntohs(ipListIt->ipAddr.sin_port) << " seenTime : " << ipListIt->seenTime << std::endl;
}
printRsItemEnd(out, "RsPeerOldNetItem", indent);
@ -1037,11 +1037,11 @@ std::ostream &RsPeerNetItem::print(std::ostream &out, uint16_t indent)
out << "lastContact: " << lastContact << std::endl;
printIndent(out, int_Indent);
out << "currentlocaladdr: " << inet_ntoa(currentlocaladdr.sin_addr);
out << "currentlocaladdr: " << rs_inet_ntoa(currentlocaladdr.sin_addr);
out << ":" << htons(currentlocaladdr.sin_port) << std::endl;
printIndent(out, int_Indent);
out << "currentremoteaddr: " << inet_ntoa(currentremoteaddr.sin_addr);
out << "currentremoteaddr: " << rs_inet_ntoa(currentremoteaddr.sin_addr);
out << ":" << htons(currentremoteaddr.sin_port) << std::endl;
printIndent(out, int_Indent);