mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-11 07:40:21 -04:00
rebased patch 0011-p3PeerMgrIMPL-UpdateOwnAddress-put-all-local-address.patch to new IPv6 branch
git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.6-IPv6-2@8243 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
46d5527e1e
commit
fe59bcdb83
1 changed files with 18 additions and 9 deletions
|
@ -965,7 +965,7 @@ void p3PeerMgrIMPL::printPeerLists(std::ostream &out)
|
||||||
* as it doesn't call back to there.
|
* as it doesn't call back to there.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool p3PeerMgrIMPL::UpdateOwnAddress(const struct sockaddr_storage &localAddr, const struct sockaddr_storage &extAddr)
|
bool p3PeerMgrIMPL::UpdateOwnAddress(const struct sockaddr_storage &localAddr, const struct sockaddr_storage &extAddr)
|
||||||
{
|
{
|
||||||
#ifdef PEER_DEBUG
|
#ifdef PEER_DEBUG
|
||||||
std::cerr << "p3PeerMgrIMPL::UpdateOwnAddress(";
|
std::cerr << "p3PeerMgrIMPL::UpdateOwnAddress(";
|
||||||
|
@ -976,16 +976,25 @@ bool p3PeerMgrIMPL::UpdateOwnAddress(const struct sockaddr_storage &localAddr,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
{
|
{
|
||||||
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
|
/****** STACK LOCK MUTEX *******/
|
||||||
|
RsStackMutex stack(mPeerMtx); (void)stack;
|
||||||
//update ip address list
|
|
||||||
pqiIpAddress ipAddressTimed;
|
|
||||||
ipAddressTimed.mAddr = localAddr;
|
|
||||||
ipAddressTimed.mSeenTime = time(NULL);
|
|
||||||
ipAddressTimed.mSrc = 0 ;
|
|
||||||
mOwnState.ipAddrs.updateLocalAddrs(ipAddressTimed);
|
|
||||||
|
|
||||||
mOwnState.localaddr = localAddr;
|
mOwnState.localaddr = localAddr;
|
||||||
|
|
||||||
|
// update ip address list
|
||||||
|
std::list<struct sockaddr_storage>::iterator it;
|
||||||
|
std::list<struct sockaddr_storage> lAddrs;
|
||||||
|
getLocalAddresses(lAddrs);
|
||||||
|
lAddrs.push_front(localAddr);
|
||||||
|
for ( it = lAddrs.begin(); it != lAddrs.end(); ++it)
|
||||||
|
{
|
||||||
|
pqiIpAddress ipAddressTimed;
|
||||||
|
ipAddressTimed.mAddr = *it;
|
||||||
|
sockaddr_storage_setport(ipAddressTimed.mAddr, sockaddr_storage_port(localAddr));
|
||||||
|
ipAddressTimed.mSeenTime = time(NULL);
|
||||||
|
ipAddressTimed.mSrc = 0 ;
|
||||||
|
mOwnState.ipAddrs.updateLocalAddrs(ipAddressTimed);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue