From deb0af06ec6fd20388e79ffae818d91dcb19267f Mon Sep 17 00:00:00 2001 From: Kirill Andreev Date: Mon, 4 May 2009 00:04:21 +0400 Subject: [PATCH] Removed peer cleanup --- .../mesh/dot11s/peer-management-protocol.cc | 28 ++++++++----------- .../mesh/dot11s/peer-management-protocol.h | 4 --- 2 files changed, 11 insertions(+), 21 deletions(-) diff --git a/src/devices/mesh/dot11s/peer-management-protocol.cc b/src/devices/mesh/dot11s/peer-management-protocol.cc index e8a376ee2..cad293a24 100644 --- a/src/devices/mesh/dot11s/peer-management-protocol.cc +++ b/src/devices/mesh/dot11s/peer-management-protocol.cc @@ -305,12 +305,21 @@ PeerManagementProtocol::InitiateLink ( Ptr PeerManagementProtocol::FindPeerLink(uint32_t interface, Mac48Address peerAddress) { - PeerCleanup (); PeerLinksMap::iterator iface = m_peerLinks.find (interface); NS_ASSERT (iface != m_peerLinks.end()); for (PeerLinksOnInterface::iterator i = iface->second.begin (); i != iface->second.end(); i++) if ((*i)->GetPeerAddress () == peerAddress) - return (*i); + { + if((*i)->LinkIsIdle ()) + { + (*i)->ClearTimingElement (); + (*i) = 0; + (iface->second).erase(i); + return 0; + } + else + return (*i); + } return 0; } void @@ -329,21 +338,6 @@ PeerManagementProtocol::GetActiveLinks(uint32_t interface) retval.push_back((*i)->GetPeerAddress ()); return retval; } -void -PeerManagementProtocol::PeerCleanup () -{ - for ( - PeerLinksMap::iterator j = m_peerLinks.begin (); - j != m_peerLinks.end (); - j++) - for (unsigned int i = j->second.size (); i > 0; i--) - if(j->second[i-1]->LinkIsIdle ()) - { - j->second[i-1]->ClearTimingElement (); - j->second[i-1] = 0; - j->second.erase (j->second.begin() + i-1); - } -} bool PeerManagementProtocol::IsActiveLink (uint32_t interface, Mac48Address peerAddress) { diff --git a/src/devices/mesh/dot11s/peer-management-protocol.h b/src/devices/mesh/dot11s/peer-management-protocol.h index 1a1704aed..4f9fd74d0 100644 --- a/src/devices/mesh/dot11s/peer-management-protocol.h +++ b/src/devices/mesh/dot11s/peer-management-protocol.h @@ -181,10 +181,6 @@ private: * \brief Indicates changes in peer links */ void PeerLinkStatus (uint32_t interface, Mac48Address peerAddress, Mac48Address peerMeshPointAddres, bool status); - /** - * Removes all links which are idle - */ - void PeerCleanup (); ///\brief BCA Time GetNextBeaconShift (uint32_t interface); private: