# HG changeset patch # User Timo Bingmann # Date 1240064026 -7200 # Node ID 1f5866271cd69c6933c0315d3dc7591172b7dc03 # Parent 72b17c213affcbea3ce48b94b0cd3393e183b588 Correction of DCF collision detection time and backoff end for simulation start. diff -r a07440ab970c src/devices/wifi/dcf-manager.cc --- a/src/devices/wifi/dcf-manager.cc Fri Apr 24 08:52:46 2009 +0200 +++ b/src/devices/wifi/dcf-manager.cc Fri Apr 24 09:50:40 2009 +0200 @@ -41,7 +41,7 @@ namespace ns3 { DcfState::DcfState () : m_backoffSlots (0), - m_backoffStart (Seconds (0.0)), + m_backoffStart (Seconds (-1.0)), m_cwMin (0), m_cwMax (0), m_cw (0), @@ -208,16 +208,16 @@ private: ****************************************************************/ DcfManager::DcfManager () - : m_lastNavStart (MicroSeconds (0)), - m_lastNavDuration (MicroSeconds (0)), - m_lastRxStart (MicroSeconds (0)), - m_lastRxDuration (MicroSeconds (0)), + : m_lastNavStart (Seconds (-1.0)), + m_lastNavDuration (Seconds (0.0)), + m_lastRxStart (Seconds (-1.0)), + m_lastRxDuration (Seconds (0.0)), m_lastRxReceivedOk (true), - m_lastRxEnd (MicroSeconds (0)), - m_lastTxStart (MicroSeconds (0)), - m_lastTxDuration (MicroSeconds (0)), - m_lastBusyStart (MicroSeconds (0)), - m_lastBusyDuration (MicroSeconds (0)), + m_lastRxEnd (Seconds (-1.0)), + m_lastTxStart (Seconds (-1.0)), + m_lastTxDuration (Seconds (0.0)), + m_lastBusyStart (Seconds (-1.0)), + m_lastBusyDuration (Seconds (0.0)), m_rxing (false), m_slotTime (Seconds (0.0)), m_sifs (Seconds (0.0)), @@ -323,8 +323,7 @@ DcfManager::RequestAccess (DcfState *sta * If there is a collision, generate a backoff * by notifying the collision to the user. */ - if (state->GetBackoffSlots () == 0 && - IsBusy ()) + if (GetBackoffEndFor (state) < Simulator::Now () && IsBusy ()) { MY_DEBUG ("medium is busy: collision"); /* someone else has accessed the medium.