From cf157422f51fd572edba9117ee26469ce18ccaa7 Mon Sep 17 00:00:00 2001 From: joss17 Date: Fri, 30 Oct 2009 00:40:31 +0000 Subject: [PATCH] improved stun check git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1767 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- libretroshare/src/pqi/p3connmgr.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libretroshare/src/pqi/p3connmgr.cc b/libretroshare/src/pqi/p3connmgr.cc index ea9b5f8d3..26e9a72fb 100644 --- a/libretroshare/src/pqi/p3connmgr.cc +++ b/libretroshare/src/pqi/p3connmgr.cc @@ -1043,18 +1043,23 @@ bool p3ConnectMgr::stunCheck() if (0 < tou_extaddr((struct sockaddr *) &raddr, &rlen, &stable)) { RsStackMutex stack(connMtx); /****** STACK LOCK MUTEX *******/ + mStunAddrStable = (stable != 0); if ((mStunExtAddr.sin_addr.s_addr != raddr.sin_addr.s_addr) || - (mStunAddrStable != stable)) + (mStunAddrStable != true)) { #ifdef CONN_DEBUG - std::cerr << "Ext Address Changed -> netReset" << std::endl; + std::cerr << "mStunExtAddr.sin_addr.s_addr : " << inet_ntoa(mStunExtAddr.sin_addr) << std::endl; + std::cerr << "raddr.sin_addr.s_addr : " << inet_ntoa(raddr.sin_addr) << std::endl; + std::cerr << "mStunAddrStable : " << mStunAddrStable << std::endl; #endif doNetReset = true; } else { + netFlagUdpOk = true; + #ifdef CONN_DEBUG std::cerr << "Ext Address Same: ok!" << std::endl; #endif @@ -1070,6 +1075,7 @@ bool p3ConnectMgr::stunCheck() if (upnpExtAdress) { //don't do a reset mStunExtAddr = extAddr; + netFlagUdpOk = false; #ifdef CONN_DEBUG std::cerr << "Found upnp Ext Address. don't do a reset." << std::endl; #endif