Modified DHT to notify of all possible stun peers, as it doesn't know whether we need to stun or not.

Added a Type parameter, so that the connection Mgr can determine if there is
an external port available or not.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@354 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2008-02-25 23:56:23 +00:00
parent 100a7aea82
commit 685182ff0b
5 changed files with 31 additions and 22 deletions

View file

@ -529,11 +529,11 @@ bool p3ConnectMgr::stunCheck()
return false;
}
void p3ConnectMgr::stunStatus(std::string id, struct sockaddr_in addr, uint32_t flags)
void p3ConnectMgr::stunStatus(std::string id, struct sockaddr_in raddr, uint32_t type, uint32_t flags)
{
std::cerr << "p3ConnectMgr::stunStatus()";
std::cerr << " id: " << RsUtil::BinToHex(id) << " addr: " << inet_ntoa(addr.sin_addr);
std::cerr << " port: " << ntohs(addr.sin_port);
std::cerr << " id: " << RsUtil::BinToHex(id) << " raddr: " << inet_ntoa(raddr.sin_addr);
std::cerr << ":" << ntohs(raddr.sin_port);
std::cerr << std::endl;
connMtx.lock(); /* LOCK MUTEX */
@ -542,17 +542,22 @@ void p3ConnectMgr::stunStatus(std::string id, struct sockaddr_in addr, uint32_t
connMtx.unlock(); /* UNLOCK MUTEX */
if (stillStunning)
/* only useful if they have an exposed TCP/UDP port */
if (type & RS_NET_CONN_TCP_EXTERNAL)
{
if (stillStunning)
{
#ifdef CONN_DEBUG
std::cerr << "p3ConnectMgr::stunStatus() Sending to UDP" << std::endl;
std::cerr << "p3ConnectMgr::stunStatus() Sending to UDP" << std::endl;
#endif
/* push to the UDP */
udpStunPeer(id, addr);
}
/* push to the UDP */
udpStunPeer(id, raddr);
}
/* push to the stunCollect */
stunCollect(id, addr, flags);
/* push to the stunCollect */
stunCollect(id, raddr, flags);
}
}
/* FLAGS