fixed spurious tx bug in AlohaNoackNetDevice
authorNicola Baldo <nbaldo@cttc.es>
Tue, 05 Jul 2011 18:40:17 +0200
changeset 7384 400f78c1d661
parent 7381 2539fd65226c
child 7385 b3e668a5949c
fixed spurious tx bug in AlohaNoackNetDevice
src/spectrum/model/aloha-noack-net-device.cc
--- a/src/spectrum/model/aloha-noack-net-device.cc	Tue Jul 05 13:32:33 2011 +0100
+++ b/src/spectrum/model/aloha-noack-net-device.cc	Tue Jul 05 18:40:17 2011 +0200
@@ -346,7 +346,7 @@
   m_macTxTrace (packet);
 
 
-
+  bool sendOk = true;
   //
   // If the device is idle, transmission starts immediately. Otherwise,
   // the transmission will be started by NotifyTransmissionEnd
@@ -366,12 +366,8 @@
           if (m_queue->Enqueue (packet) == false)
             {
               m_macTxDropTrace (packet);
-              return false;
+              sendOk = false;
             }
-          NS_LOG_LOGIC ("transmitting head-of-queue packet");
-          m_currentPkt = m_queue->Dequeue ();
-          NS_ASSERT (m_currentPkt != 0);
-          StartTransmission ();
         }
     }
   else
@@ -381,10 +377,10 @@
       if (m_queue->Enqueue (packet) == false)
         {
           m_macTxDropTrace (packet);
-          return false;
+          sendOk = false;
         }
     }
-  return true;
+  return sendOk;
 }
 
 void
@@ -425,6 +421,7 @@
     {
       m_currentPkt = m_queue->Dequeue ();
       NS_ASSERT (m_currentPkt);
+      NS_LOG_LOGIC ("scheduling transmission now");
       Simulator::ScheduleNow (&AlohaNoackNetDevice::StartTransmission, this);
     }
 }