|
Lines 163-177
WifiMacQueue::Enqueue (Ptr<WifiMacQueueItem> item)
|
Link Here
|
|---|
|
| 163 |
|
163 |
|
| 164 |
NS_ASSERT_MSG (GetMode () == QueueBase::QUEUE_MODE_PACKETS, "WifiMacQueues must be in packet mode"); |
164 |
NS_ASSERT_MSG (GetMode () == QueueBase::QUEUE_MODE_PACKETS, "WifiMacQueues must be in packet mode"); |
| 165 |
|
165 |
|
| 166 |
// if the queue is full, check if the time-to-live of the oldest packet has |
166 |
// if the queue is full, remove the first stale packet (if any) encountered |
| 167 |
// expired. If so, it can be removed so as to make room for the new packet. |
167 |
// starting from the head of the queue, in order to make room for the new packet. |
| 168 |
if (GetNPackets () == GetMaxPackets ()) |
168 |
if (QueueBase::GetNPackets () == GetMaxPackets ()) |
| 169 |
{ |
169 |
{ |
| 170 |
auto it = Head (); |
170 |
auto it = Head (); |
| 171 |
TtlExceeded (it); |
171 |
while (it != Tail () && !TtlExceeded (it)) |
|
|
172 |
{ |
| 173 |
it++; |
| 174 |
} |
| 172 |
} |
175 |
} |
| 173 |
|
176 |
|
| 174 |
if (GetNPackets () == GetMaxPackets () && m_dropPolicy == DROP_OLDEST) |
177 |
if (QueueBase::GetNPackets () == GetMaxPackets () && m_dropPolicy == DROP_OLDEST) |
| 175 |
{ |
178 |
{ |
| 176 |
NS_LOG_DEBUG ("Remove the oldest item in the queue"); |
179 |
NS_LOG_DEBUG ("Remove the oldest item in the queue"); |
| 177 |
DoRemove (Head ()); |
180 |
DoRemove (Head ()); |
|
Lines 188-202
WifiMacQueue::PushFront (Ptr<WifiMacQueueItem> item)
|
Link Here
|
|---|
|
| 188 |
|
191 |
|
| 189 |
NS_ASSERT_MSG (GetMode () == QueueBase::QUEUE_MODE_PACKETS, "WifiMacQueues must be in packet mode"); |
192 |
NS_ASSERT_MSG (GetMode () == QueueBase::QUEUE_MODE_PACKETS, "WifiMacQueues must be in packet mode"); |
| 190 |
|
193 |
|
| 191 |
// if the queue is full, check if the time-to-live of the oldest packet has |
194 |
// if the queue is full, remove the first stale packet (if any) encountered |
| 192 |
// expired. If so, it can be removed so as to make room for the new packet. |
195 |
// starting from the head of the queue, in order to make room for the new packet. |
| 193 |
if (GetNPackets () == GetMaxPackets ()) |
196 |
if (QueueBase::GetNPackets () == GetMaxPackets ()) |
| 194 |
{ |
197 |
{ |
| 195 |
auto it = Head (); |
198 |
auto it = Head (); |
| 196 |
TtlExceeded (it); |
199 |
while (it != Tail () && !TtlExceeded (it)) |
|
|
200 |
{ |
| 201 |
it++; |
| 202 |
} |
| 197 |
} |
203 |
} |
| 198 |
|
204 |
|
| 199 |
if (GetNPackets () == GetMaxPackets () && m_dropPolicy == DROP_OLDEST) |
205 |
if (QueueBase::GetNPackets () == GetMaxPackets () && m_dropPolicy == DROP_OLDEST) |
| 200 |
{ |
206 |
{ |
| 201 |
NS_LOG_DEBUG ("Remove the oldest item in the queue"); |
207 |
NS_LOG_DEBUG ("Remove the oldest item in the queue"); |
| 202 |
DoRemove (Head ()); |
208 |
DoRemove (Head ()); |