diff -r 7e5c1a14eff3 src/devices/wimax/bs-scheduler-rtps.cc --- a/src/devices/wimax/bs-scheduler-rtps.cc Wed Sep 15 20:43:31 2010 -0700 +++ b/src/devices/wimax/bs-scheduler-rtps.cc Thu Sep 16 15:53:01 2010 +1000 @@ -494,7 +494,7 @@ ServiceFlowRecord *serviceFlowRecord; std::vector serviceFlows; - std::deque::const_iterator iter3; +/// std::deque::const_iterator iter3; uint32_t symbolsRequired[100]; WimaxPhy::ModulationType modulationType_[100]; uint8_t diuc_[100]; diff -r 7e5c1a14eff3 src/devices/wimax/bs-scheduler-simple.cc --- a/src/devices/wimax/bs-scheduler-simple.cc Wed Sep 15 20:43:31 2010 -0700 +++ b/src/devices/wimax/bs-scheduler-simple.cc Thu Sep 16 15:53:01 2010 +1000 @@ -159,13 +159,18 @@ { uint32_t BurstSizeSymbols = GetBs ()->GetPhy ()->GetNrSymbols (burst->GetSize (), modulationType); AddDownlinkBurst (connection, diuc, modulationType, burst); - availableSymbols -= BurstSizeSymbols; + + if (availableSymbols <= BurstSizeSymbols) + { + availableSymbols -= BurstSizeSymbols; // XXX: Overflows but don't know how to fix + break; + } } } else { burst = Create (); - while (availableSymbols >= 0 && connection->HasPackets () == true) + while (connection->HasPackets () == true) { uint32_t FirstPacketSize = connection->GetQueue ()->GetFirstPacketRequiredByte (MacHeaderType::HEADER_TYPE_GENERIC); nrSymbolsRequired = GetBs ()->GetPhy ()->GetNrSymbols (FirstPacketSize, modulationType); @@ -190,7 +195,7 @@ } AddDownlinkBurst (connection, diuc, modulationType, burst); } - if (availableSymbols <= 0) + if (availableSymbols == 0) { break; } diff -r 7e5c1a14eff3 src/devices/wimax/simple-ofdm-wimax-phy.cc --- a/src/devices/wimax/simple-ofdm-wimax-phy.cc Wed Sep 15 20:43:31 2010 -0700 +++ b/src/devices/wimax/simple-ofdm-wimax-phy.cc Thu Sep 16 15:53:01 2010 +1000 @@ -797,7 +797,7 @@ m_nrBlocks = GetNrBlocks (burstSize, modulationType); m_paddingBits = (m_nrBlocks * m_blockSize) - (burstSize * 8); m_nrRemainingBlocksToSend = m_nrBlocks; - NS_ASSERT_MSG (m_paddingBits >= 0, "Size of padding bytes < 0"); + NS_ASSERT_MSG ((m_nrBlocks * m_blockSize) >= (burstSize * 8), "Size of padding bytes < 0"); } uint16_t diff -r 7e5c1a14eff3 src/devices/wimax/wimax-mac-queue.cc --- a/src/devices/wimax/wimax-mac-queue.cc Wed Sep 15 20:43:31 2010 -0700 +++ b/src/devices/wimax/wimax-mac-queue.cc Thu Sep 16 15:53:01 2010 +1000 @@ -171,16 +171,16 @@ if (element.m_hdrType.GetType () == MacHeaderType::HEADER_TYPE_GENERIC) { NS_LOG_INFO ("Enqueued Packet IS A data packet"); + NS_ASSERT_MSG (m_nrDataPackets >= 1, + "Can not enqueue more packets: no space left in the queue"); m_nrDataPackets--; - NS_ASSERT_MSG (m_nrDataPackets >= 0, - "Can not enqueue more packets: no space left in the queue"); } else { NS_LOG_INFO ("Enqueued Packet IS A Request BW packet"); + NS_ASSERT_MSG (m_nrRequestPackets >= 1, + "Can not enqueue more packets: no space left in the queue"); m_nrRequestPackets--; - NS_ASSERT_MSG (m_nrRequestPackets >= 0, - "Can not enqueue more packets: no space left in the queue"); } Ptr packet = element.m_packet;