View | Details | Raw Unified | Return to bug 2634
Collapse All | Expand All

(-)a/src/network/utils/drop-tail-queue.cc (+14 lines)
 Lines 53-58    Link Here 
53
  NS_LOG_FUNCTION (this << item);
53
  NS_LOG_FUNCTION (this << item);
54
  NS_ASSERT (m_packets.size () == GetNPackets ());
54
  NS_ASSERT (m_packets.size () == GetNPackets ());
55
55
56
  if (GetMode () == QUEUE_MODE_PACKETS && (GetNPackets () >= GetMaxPackets ()))
57
    {
58
      NS_LOG_LOGIC ("Queue full (at max packets) -- dropping pkt");
59
      Drop (item);
60
      return false;
61
    }
62
63
  if (GetMode () == QUEUE_MODE_BYTES && (GetNBytes () + item->GetPacketSize () > GetMaxBytes ()))
64
    {
65
      NS_LOG_LOGIC ("Queue full (packet would exceed max bytes) -- dropping pkt");
66
      Drop (item);
67
      return false;
68
    }
69
56
  m_packets.push (item);
70
  m_packets.push (item);
57
71
58
  return true;
72
  return true;
(-)a/src/network/utils/queue.cc (-18 / +4 lines)
 Lines 98-117    Link Here 
98
{
98
{
99
  NS_LOG_FUNCTION (this << item);
99
  NS_LOG_FUNCTION (this << item);
100
100
101
  if (m_mode == QUEUE_MODE_PACKETS && (m_nPackets.Get () >= m_maxPackets))
102
    {
103
      NS_LOG_LOGIC ("Queue full (at max packets) -- dropping pkt");
104
      Drop (item);
105
      return false;
106
    }
107
108
  if (m_mode == QUEUE_MODE_BYTES && (m_nBytes.Get () + item->GetPacketSize () > m_maxBytes))
109
    {
110
      NS_LOG_LOGIC ("Queue full (packet would exceed max bytes) -- dropping pkt");
111
      Drop (item);
112
      return false;
113
    }
114
115
  //
101
  //
116
  // If DoEnqueue fails, Queue::Drop is called by the subclass
102
  // If DoEnqueue fails, Queue::Drop is called by the subclass
117
  //
103
  //
 Lines 213-228    Link Here 
213
Queue::GetNPackets (void) const
199
Queue::GetNPackets (void) const
214
{
200
{
215
  NS_LOG_FUNCTION (this);
201
  NS_LOG_FUNCTION (this);
216
  NS_LOG_LOGIC ("returns " << m_nPackets);
202
  NS_LOG_LOGIC ("returns " << m_nPackets.Get ());
217
  return m_nPackets;
203
  return m_nPackets.Get ();
218
}
204
}
219
205
220
uint32_t
206
uint32_t
221
Queue::GetNBytes (void) const
207
Queue::GetNBytes (void) const
222
{
208
{
223
  NS_LOG_FUNCTION (this);
209
  NS_LOG_FUNCTION (this);
224
  NS_LOG_LOGIC (" returns " << m_nBytes);
210
  NS_LOG_LOGIC (" returns " << m_nBytes.Get ());
225
  return m_nBytes;
211
  return m_nBytes.Get ();
226
}
212
}
227
213
228
bool
214
bool

Return to bug 2634