mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-24 14:20:44 -04:00
Added Address update from p3NetMgr => p3PeerMgr, when external address has been determined.
* extract external address from DhtStunner if possible. * added p3PeerMgr::UpdateOwnAddress(), which should only be called by p3netmgr. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4512 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
7e6c58dd10
commit
3ef08fead5
3 changed files with 100 additions and 7 deletions
|
@ -641,6 +641,52 @@ bool p3PeerMgrIMPL::addNeighbour(std::string id)
|
|||
**********************************************************************/
|
||||
|
||||
|
||||
/* This function should only be called from NetMgr,
|
||||
* as it doesn't call back to there.
|
||||
*/
|
||||
|
||||
bool p3PeerMgrIMPL::UpdateOwnAddress(const struct sockaddr_in &localAddr, const struct sockaddr_in &extAddr)
|
||||
{
|
||||
std::cerr << "p3PeerMgrIMPL::UpdateOwnAddress(";
|
||||
std::cerr << rs_inet_ntoa(localAddr.sin_addr) << ":" << htons(localAddr.sin_port);
|
||||
std::cerr << ", ";
|
||||
std::cerr << rs_inet_ntoa(extAddr.sin_addr) << ":" << htons(extAddr.sin_port);
|
||||
std::cerr << ")" << std::endl;
|
||||
|
||||
{
|
||||
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
|
||||
|
||||
//update ip address list
|
||||
pqiIpAddress ipAddressTimed;
|
||||
ipAddressTimed.mAddr = localAddr;
|
||||
ipAddressTimed.mSeenTime = time(NULL);
|
||||
mOwnState.ipAddrs.updateLocalAddrs(ipAddressTimed);
|
||||
|
||||
mOwnState.localaddr = localAddr;
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
|
||||
|
||||
//update ip address list
|
||||
pqiIpAddress ipAddressTimed;
|
||||
ipAddressTimed.mAddr = extAddr;
|
||||
ipAddressTimed.mSeenTime = time(NULL);
|
||||
mOwnState.ipAddrs.updateExtAddrs(ipAddressTimed);
|
||||
|
||||
mOwnState.serveraddr = extAddr;
|
||||
}
|
||||
|
||||
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
|
||||
mLinkMgr->setLocalAddress(localAddr);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
bool p3PeerMgrIMPL::setLocalAddress(const std::string &id, struct sockaddr_in addr)
|
||||
{
|
||||
if (id == AuthSSL::getAuthSSL()->OwnId())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue