equal
deleted
inserted
replaced
491 } |
491 } |
492 void |
492 void |
493 MeshWifiInterfaceMac::SetBeaconGeneration (bool enable) |
493 MeshWifiInterfaceMac::SetBeaconGeneration (bool enable) |
494 { |
494 { |
495 NS_LOG_FUNCTION (this << enable); |
495 NS_LOG_FUNCTION (this << enable); |
|
496 UniformVariable coefficient (0.0, m_randomStart.GetSeconds ()); |
496 if (enable) |
497 if (enable) |
497 { |
498 { |
|
499 Time randomStart = Seconds (coefficient.GetValue ()); |
498 // Now start sending beacons after some random delay (to avoid collisions) |
500 // Now start sending beacons after some random delay (to avoid collisions) |
499 UniformVariable coefficient (0.0, m_randomStart.GetSeconds ()); |
501 NS_ASSERT (!m_beaconSendEvent.IsRunning ()); |
500 Time randomStart = Seconds (coefficient.GetValue ()); |
|
501 |
|
502 m_beaconSendEvent = Simulator::Schedule (randomStart, &MeshWifiInterfaceMac::SendBeacon, this); |
502 m_beaconSendEvent = Simulator::Schedule (randomStart, &MeshWifiInterfaceMac::SendBeacon, this); |
503 m_tbtt = Simulator::Now () + randomStart; |
503 m_tbtt = Simulator::Now () + randomStart; |
504 } |
504 } |
505 else |
505 else |
506 { |
506 { |