src/devices/wifi/dcf-manager.cc
changeset 2140 acfd79fc8d65
parent 2130 741d0b976a78
child 2142 63c08450a4da
--- a/src/devices/wifi/dcf-manager.cc	Mon Nov 19 09:22:17 2007 +0100
+++ b/src/devices/wifi/dcf-manager.cc	Mon Nov 19 12:58:36 2007 +0100
@@ -11,7 +11,7 @@
 NS_LOG_COMPONENT_DEFINE ("DcfManager");
 
 #define MY_DEBUG(x) \
-  NS_LOG_DEBUG (Simulator::Now () << " " x)
+  NS_LOG_DEBUG (Simulator::Now () << " " << this << " " << x)
 
 namespace ns3 {
 
@@ -60,6 +60,7 @@
   uint32_t n = std::min (nSlots, m_backoffSlots);
   m_backoffSlots -= n;
   m_backoffStart = backoffUpdateBound;
+  MY_DEBUG ("update slots="<<nSlots<<" slots, backoff="<<m_backoffSlots);
 }
 
 void 
@@ -218,7 +219,7 @@
            * This is the first dcf we find with an expired backoff and which
            * needs access to the medium. i.e., it has data to send.
            */
-          MY_DEBUG ("dcf " << k << " needs access. backoff expired. access granted.");
+          MY_DEBUG ("dcf " << k << " needs access. backoff expired. access granted. slots="<<state->GetBackoffSlots ());
           i++; // go to the next item in the list.
           k++;
           std::vector<DcfState *> internalCollisionStates;
@@ -331,7 +332,7 @@
            * slots is smaller than its AIFSN, the backoff did not start, so,
            * we do not update it.
            */
-          if (nIntSlots > state->GetAifsn ())
+          if (nIntSlots >= state->GetAifsn ())
             {
               MY_DEBUG ("dcf " << k << " dec backoff slots=" << nIntSlots);
               Time backoffUpdateBound = backoffStart + Scalar (nIntSlots) * m_slotTime;
@@ -378,7 +379,7 @@
                                                  &DcfManager::AccessTimeout, this);
         }
     }
-    }
+}
 
 void 
 DcfManager::NotifyRxStartNow (Time duration)