From d5195f6d6e43cc793dbbc6da260b60e835075959 Mon Sep 17 00:00:00 2001 From: Mohamed Amine Ismail Date: Fri, 19 Mar 2010 20:58:23 +0100 Subject: [PATCH] fix PR#847 Segfaults on BaseStationNetDevice with OnOffApplication and rtPS sched --- src/devices/wimax/bs-scheduler-rtps.cc | 15 +++++++++------ src/devices/wimax/packet-burst.cc | 5 ++++- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/devices/wimax/bs-scheduler-rtps.cc b/src/devices/wimax/bs-scheduler-rtps.cc index af950633f..358230a2a 100644 --- a/src/devices/wimax/bs-scheduler-rtps.cc +++ b/src/devices/wimax/bs-scheduler-rtps.cc @@ -226,7 +226,6 @@ BSSchedulerRtps::BSSchedulerBroadcastConnection (uint32_t &availableSymbols) packet = connection->GetQueue ()->Peek (hdr); nrSymbolsRequired = GetBs ()->GetPhy ()->GetNrSymbols (packet->GetSize (), modulationType); - // PIRO: check for fragmentation if (availableSymbols < nrSymbolsRequired && !CheckForFragmentation (connection, availableSymbols, modulationType)) { @@ -460,15 +459,18 @@ BSSchedulerRtps::BSSchedulerUGSConnection (uint32_t &availableSymbols) nrSymbolsRequired = connection->GetServiceFlow ()->GetRecord ()->GetGrantSize (); - // PIRO: packet fragmentation for UGS connections has not been implemented yet! + // Packet fragmentation for UGS connections has not been implemented yet! if (availableSymbols > nrSymbolsRequired) { availableSymbols -= nrSymbolsRequired; burst = CreateUgsBurst (connection->GetServiceFlow (), modulationType, nrSymbolsRequired); - AddDownlinkBurst (connection, diuc, modulationType, burst); - currentTime = Simulator::Now (); - serviceFlowRecord->SetDlTimeStamp (currentTime); - burst = Create (); + if (burst->GetNPackets () != 0) + { + AddDownlinkBurst (connection, diuc, modulationType, burst); + currentTime = Simulator::Now (); + serviceFlowRecord->SetDlTimeStamp (currentTime); + burst = Create (); + } } } } @@ -562,6 +564,7 @@ BSSchedulerRtps::BSSchedulerRTPSConnection (uint32_t &availableSymbols) // Downlink Bandwidth Allocation for (int i = 0; i < nbConnection; i++) { + packet = rtPSConnection[i]->GetQueue ()->Peek (hdr); uint32_t symbolsForPacketTransmission = 0; burst = Create (); diff --git a/src/devices/wimax/packet-burst.cc b/src/devices/wimax/packet-burst.cc index ce651b8e4..ea7cdb242 100644 --- a/src/devices/wimax/packet-burst.cc +++ b/src/devices/wimax/packet-burst.cc @@ -76,7 +76,10 @@ Ptr PacketBurst::Copy (void) const void PacketBurst::AddPacket (Ptr packet) { - m_packets.push_back (packet); + if (packet) + { + m_packets.push_back (packet); + } } std::list >