src/internet-node/arp-l3-protocol.cc
changeset 3151 428f8ec6da29
parent 3147 e0c2a7c2eb5f
child 3152 4260de124c74
--- a/src/internet-node/arp-l3-protocol.cc	Sun May 25 14:44:14 2008 -0700
+++ b/src/internet-node/arp-l3-protocol.cc	Sun May 25 14:44:36 2008 -0700
@@ -53,12 +53,12 @@
 
 ArpL3Protocol::ArpL3Protocol ()
 {
-  NS_LOG_FUNCTION_NOARGS ();
+  NS_LOG_FUNCTION (this);
 }
 
 ArpL3Protocol::~ArpL3Protocol ()
 {
-  NS_LOG_FUNCTION_NOARGS ();
+  NS_LOG_FUNCTION (this);
 }
 
 void 
@@ -70,7 +70,12 @@
 void 
 ArpL3Protocol::DoDispose (void)
 {
-  NS_LOG_FUNCTION_NOARGS ();
+  NS_LOG_FUNCTION (this);
+  for (CacheList::iterator i = m_cacheList.begin (); i != m_cacheList.end (); ++i)
+    {
+      Ptr<ArpCache> cache = *i;
+      cache->Dispose ();
+    }
   m_cacheList.clear ();
   m_node = 0;
   Object::DoDispose ();
@@ -145,8 +150,17 @@
                         arp.GetSourceIpv4Address ()
                      << " for waiting entry -- flush");
               Address from_mac = arp.GetSourceHardwareAddress ();
-              Ptr<Packet> waiting = entry->MarkAlive (from_mac);
-	      cache->GetInterface ()->Send (waiting, arp.GetSourceIpv4Address ());
+              entry->MarkAlive (from_mac);
+              while (true)
+                {
+                  Ptr<Packet> pending = entry->DequeuePending();
+                  if (pending != 0)
+                    {
+                      break;
+                    }
+                  cache->GetInterface ()->Send (pending,
+                                                arp.GetSourceIpv4Address ());
+                }
             } 
           else 
             {
@@ -210,25 +224,24 @@
           if (entry->IsDead ()) 
             {
               NS_LOG_LOGIC ("node="<<m_node->GetId ()<<
-                        ", dead entry for " << destination << " valid -- drop");
+                            ", dead entry for " << destination << " valid -- drop");
 	      // XXX report packet as 'dropped'
             } 
           else if (entry->IsAlive ()) 
             {
               NS_LOG_LOGIC ("node="<<m_node->GetId ()<<
-                        ", alive entry for " << destination << " valid -- send");
+                            ", alive entry for " << destination << " valid -- send");
 	      *hardwareDestination = entry->GetMacAddress ();
               return true;
             } 
           else if (entry->IsWaitReply ()) 
             {
               NS_LOG_LOGIC ("node="<<m_node->GetId ()<<
-                        ", wait reply for " << destination << " valid -- drop previous");
-              Ptr<Packet> old = entry->UpdateWaitReply (packet);
-	      // XXX report 'old' packet as 'dropped'
+                            ", wait reply for " << destination << " valid -- drop previous");
+              // XXX potentially report current packet as 'dropped'
+              entry->UpdateWaitReply (packet);
             }
         }
-
     }
   else
     {