fix PR#847 Segfaults on BaseStationNetDevice with OnOffApplication and rtPS sched
--- a/src/devices/wimax/bs-scheduler-rtps.cc Fri Mar 19 20:07:09 2010 +0100
+++ b/src/devices/wimax/bs-scheduler-rtps.cc Fri Mar 19 20:58:23 2010 +0100
@@ -226,7 +226,6 @@
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 @@
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<PacketBurst> ();
+ if (burst->GetNPackets () != 0)
+ {
+ AddDownlinkBurst (connection, diuc, modulationType, burst);
+ currentTime = Simulator::Now ();
+ serviceFlowRecord->SetDlTimeStamp (currentTime);
+ burst = Create<PacketBurst> ();
+ }
}
}
}
@@ -562,6 +564,7 @@
// Downlink Bandwidth Allocation
for (int i = 0; i < nbConnection; i++)
{
+
packet = rtPSConnection[i]->GetQueue ()->Peek (hdr);
uint32_t symbolsForPacketTransmission = 0;
burst = Create<PacketBurst> ();
--- a/src/devices/wimax/packet-burst.cc Fri Mar 19 20:07:09 2010 +0100
+++ b/src/devices/wimax/packet-burst.cc Fri Mar 19 20:58:23 2010 +0100
@@ -76,7 +76,10 @@
void
PacketBurst::AddPacket (Ptr<Packet> packet)
{
- m_packets.push_back (packet);
+ if (packet)
+ {
+ m_packets.push_back (packet);
+ }
}
std::list<Ptr<Packet> >