fix Bug 836: Delay is incremented over time with BsUplinkSchedulerSimple and BsUplinkSchedulerRtps
authorMohamed Amine Ismail <amine.ismail@sophia.inria.fr>
Thu, 11 Mar 2010 14:18:52 +0100
changeset 6124 c5ac3970262c
parent 6123 4fc850094aeb
child 6125 af2b07e6025e
fix Bug 836: Delay is incremented over time with BsUplinkSchedulerSimple and BsUplinkSchedulerRtps
src/devices/wimax/bandwidth-manager.cc
src/devices/wimax/bs-uplink-scheduler-simple.cc
src/devices/wimax/service-flow.cc
--- a/src/devices/wimax/bandwidth-manager.cc	Thu Mar 11 13:37:22 2010 +0300
+++ b/src/devices/wimax/bandwidth-manager.cc	Thu Mar 11 14:18:52 2010 +0100
@@ -182,6 +182,7 @@
   else
     {
       serviceFlow->GetRecord ()->SetRequestedBandwidth (bwRequestHdr.GetBr ());
+      bs->GetUplinkScheduler()->OnSetRequestedBandwidth(serviceFlow->GetRecord());
     }
   bs->GetUplinkScheduler ()->ProcessBandwidthRequest (bwRequestHdr);
   // update backlogged
--- a/src/devices/wimax/bs-uplink-scheduler-simple.cc	Thu Mar 11 13:37:22 2010 +0300
+++ b/src/devices/wimax/bs-uplink-scheduler-simple.cc	Thu Mar 11 14:18:52 2010 +0100
@@ -576,8 +576,9 @@
 void
 UplinkSchedulerSimple::OnSetRequestedBandwidth (ServiceFlowRecord *sfr)
 {
-  // virtual function on UplinkScheduler
-  // this is not necessary on this implementation
+  // m_grantedBandwidth must be reset to zero
+  uint32_t grantedBandwidth = 0;
+  sfr->SetGrantedBandwidth (grantedBandwidth);
 }
 
 } // namespace ns3
--- a/src/devices/wimax/service-flow.cc	Thu Mar 11 13:37:22 2010 +0300
+++ b/src/devices/wimax/service-flow.cc	Thu Mar 11 14:18:52 2010 +0100
@@ -251,6 +251,7 @@
 Ptr<WimaxMacQueue>
 ServiceFlow::GetQueue (void) const
 {
+  if (!m_connection) return 0;
   return m_connection->GetQueue ();
 }
 
@@ -263,12 +264,14 @@
 bool
 ServiceFlow::HasPackets (void) const
 {
+  if (!m_connection) return false;
   return m_connection->HasPackets ();
 }
 
 bool
 ServiceFlow::HasPackets (MacHeaderType::HeaderType packetType) const
 {
+  if (!m_connection) return false;
   return m_connection->HasPackets (packetType);
 }
 
@@ -279,19 +282,20 @@
   Time timeStamp;
   Ptr<Packet> packet;
   Time currentTime = Simulator::Now ();
-
-  while (m_connection->HasPackets ())
-    {
-      packet = m_connection->GetQueue ()->Peek (hdr, timeStamp);
+  if (m_connection){
+    while (m_connection->HasPackets ())
+      {
+        packet = m_connection->GetQueue ()->Peek (hdr, timeStamp);
 
-      if (currentTime - timeStamp > MilliSeconds (GetMaximumLatency ()))
-        {
-          m_connection->Dequeue ();
-        }
-      else
-        {
-          break;
-        }
+        if (currentTime - timeStamp > MilliSeconds (GetMaximumLatency ()))
+          {
+            m_connection->Dequeue ();
+          }
+        else
+          {
+            break;
+          }
+      }
     }
 }