mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
fixed proper sorting of IP lists.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5.0@2989 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
88018d4512
commit
d6bb8f5f00
@ -3483,7 +3483,7 @@ void peerConnectState::updateIpAddressList(const IpAddressTimed& ipTimed)
|
||||
}
|
||||
|
||||
// 2 - check if the ip list already contains the current remote address of the connected peer. In such a case,
|
||||
// we update the time stamp.
|
||||
// we remove the list entry, and update the time stamp. We only compare ips not ports, so that the last port is kept.
|
||||
//
|
||||
bool found = false;
|
||||
for (std::list<IpAddressTimed>::iterator ipListIt = ipAddressList.begin(); ipListIt!=(ipAddressList.end()) && !found; ++ipListIt)
|
||||
@ -3492,20 +3492,21 @@ void peerConnectState::updateIpAddressList(const IpAddressTimed& ipTimed)
|
||||
#ifdef CONN_DEBUG
|
||||
std::cerr << "peerConnectState::updateIpAdressList() ip found in the list." << std::endl;
|
||||
#endif
|
||||
found = true;
|
||||
//update the seen time
|
||||
//
|
||||
if (ipListIt->seenTime < ipTimed.seenTime)
|
||||
if ( (*ipListIt).seenTime < ipTimed.seenTime)
|
||||
{
|
||||
(*ipListIt).seenTime = ipTimed.seenTime;
|
||||
(*ipListIt).ipAddr.sin_port = ipTimed.ipAddr.sin_port ; // keep the port of the most recent address.
|
||||
ipAddressList.erase(ipListIt) ;
|
||||
#ifdef CONN_DEBUG
|
||||
std::cerr << "peerConnectState::updateIpAdressList() Update seen time to : " << ipTimed.seenTime << std::endl;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
found = true; // We keep the entry.
|
||||
break ;
|
||||
}
|
||||
|
||||
// if not found, insert the address at sorted position into the list
|
||||
// if not found (or removed), insert the address at sorted position into the list
|
||||
//
|
||||
if (!found)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user