From cf2a72012dfaf2448dc24ffdf2d82faede3caaa5 Mon Sep 17 00:00:00 2001 From: Kirill Andreev Date: Mon, 4 May 2009 17:13:20 +0400 Subject: [PATCH] Fixed removing peer links --- src/devices/mesh/dot11s/peer-link.cc | 17 ++++++++++++----- src/devices/mesh/dot11s/peer-link.h | 3 ++- .../mesh/dot11s/peer-management-protocol.cc | 8 ++++---- .../mesh/dot11s/peer-management-protocol.h | 1 + 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/src/devices/mesh/dot11s/peer-link.cc b/src/devices/mesh/dot11s/peer-link.cc index 68daa9a10..ad8398ac3 100644 --- a/src/devices/mesh/dot11s/peer-link.cc +++ b/src/devices/mesh/dot11s/peer-link.cc @@ -78,6 +78,18 @@ PeerLink::PeerLink (): m_retryCounter (0) { } +PeerLink::~PeerLink () +{ +} +void +PeerLink::DoDispose () +{ + m_retryTimer.Cancel (); + m_holdingTimer.Cancel (); + m_confirmTimer.Cancel (); + m_beaconLossTimer.Cancel (); + m_beaconTiming.ClearTimingElement (); +} void PeerLink::SetPeerAddress (Mac48Address macaddr) { @@ -154,11 +166,6 @@ PeerLink::GetBeaconTimingElement () const return m_beaconTiming; } void -PeerLink::ClearTimingElement () -{ - m_beaconTiming.ClearTimingElement (); -} -void PeerLink::MLMECancelPeerLink (PmpReasonCode reason) { StateMachine (CNCL,reason); diff --git a/src/devices/mesh/dot11s/peer-link.h b/src/devices/mesh/dot11s/peer-link.h index d918e9339..9ca02d471 100644 --- a/src/devices/mesh/dot11s/peer-link.h +++ b/src/devices/mesh/dot11s/peer-link.h @@ -45,6 +45,8 @@ public: static TypeId GetTypeId(); /// C-tor create empty link PeerLink (); + ~PeerLink (); + void DoDispose (); /// Process beacon received from peer void SetBeaconInformation (Time lastBeacon, Time BeaconInterval); @@ -73,7 +75,6 @@ public: Time GetBeaconInterval () const; IeBeaconTiming GetBeaconTimingElement ()const; IePeerManagement GetPeerLinkDescriptorElement ()const; - void ClearTimingElement (); //\} /** diff --git a/src/devices/mesh/dot11s/peer-management-protocol.cc b/src/devices/mesh/dot11s/peer-management-protocol.cc index cad293a24..a014b7bcb 100644 --- a/src/devices/mesh/dot11s/peer-management-protocol.cc +++ b/src/devices/mesh/dot11s/peer-management-protocol.cc @@ -68,16 +68,17 @@ PeerManagementProtocol::PeerManagementProtocol (): { } PeerManagementProtocol::~PeerManagementProtocol () +{ +} +void +PeerManagementProtocol::DoDispose () { //cancel cleanup event and go through the map of peer links, //deleting each for (PeerLinksMap::iterator j = m_peerLinks.begin (); j != m_peerLinks.end (); j++) { for (PeerLinksOnInterface::iterator i = j->second.begin (); i != j->second.end(); i++) - { - (*i)->ClearTimingElement (); (*i) = 0; - } j->second.clear (); } m_peerLinks.clear (); @@ -312,7 +313,6 @@ PeerManagementProtocol::FindPeerLink(uint32_t interface, Mac48Address peerAddres { if((*i)->LinkIsIdle ()) { - (*i)->ClearTimingElement (); (*i) = 0; (iface->second).erase(i); return 0; diff --git a/src/devices/mesh/dot11s/peer-management-protocol.h b/src/devices/mesh/dot11s/peer-management-protocol.h index 4f9fd74d0..b61c293fc 100644 --- a/src/devices/mesh/dot11s/peer-management-protocol.h +++ b/src/devices/mesh/dot11s/peer-management-protocol.h @@ -49,6 +49,7 @@ public: PeerManagementProtocol (); ~PeerManagementProtocol (); static TypeId GetTypeId (); + void DoDispose (); /** * \brief Install PMP on given mesh point. *