src/devices/mesh/mesh-wifi-interface-mac.cc
changeset 5178 fa7d9b667efc
parent 5156 5b499f25655a
child 5349 8e8459d1831b
--- a/src/devices/mesh/mesh-wifi-interface-mac.cc	Wed Sep 02 14:58:36 2009 +0400
+++ b/src/devices/mesh/mesh-wifi-interface-mac.cc	Mon Sep 07 16:04:15 2009 +0400
@@ -493,12 +493,12 @@
 MeshWifiInterfaceMac::SetBeaconGeneration (bool enable)
 {
   NS_LOG_FUNCTION (this << enable);
+  UniformVariable coefficient (0.0, m_randomStart.GetSeconds ());
   if (enable)
     {
+      Time randomStart = Seconds (coefficient.GetValue ());
       // Now start sending beacons after some random delay (to avoid collisions)
-      UniformVariable coefficient (0.0, m_randomStart.GetSeconds ());
-      Time randomStart = Seconds (coefficient.GetValue ());
-
+      NS_ASSERT (!m_beaconSendEvent.IsRunning ());
       m_beaconSendEvent = Simulator::Schedule (randomStart, &MeshWifiInterfaceMac::SendBeacon, this);
       m_tbtt = Simulator::Now () + randomStart;
     }