When giving up PIT entry, remove all outgoing interests. Otherwise,
everything can stuck (was happening...)

Modified experiment with synthetic topology
diff --git a/model/annotated-topology-reader.cc b/model/annotated-topology-reader.cc
index 8caceb1..edcff58 100644
--- a/model/annotated-topology-reader.cc
+++ b/model/annotated-topology-reader.cc
@@ -137,7 +137,7 @@
       double latitude, longitude;
 
       lineBuffer >> name >> city >> latitude >> longitude;
-      Ptr<Node> node = CreateNode (name, 2*longitude, -2*latitude);
+      Ptr<Node> node = CreateNode (name, longitude, -latitude);
       nodes.Add (node);
     }
 
@@ -154,9 +154,9 @@
       // NS_LOG_DEBUG ("Input: [" << line << "]");
       
       istringstream lineBuffer (line);
-      string from, to, capacity, metric, delay, queueSizeNode1, queueSizeNode2;
+      string from, to, capacity, metric, delay, maxPackets;
 
-      lineBuffer >> from >> to >> capacity >> metric >> delay >> queueSizeNode1 >> queueSizeNode2;
+      lineBuffer >> from >> to >> capacity >> metric >> delay >> maxPackets;
 
       if (processedLinks[to].size () != 0 &&
           processedLinks[to].find (from) != processedLinks[to].end ())
@@ -177,13 +177,11 @@
 
       if (!delay.empty ())
           link.SetAttribute ("Delay", delay);
-      if (!queueSizeNode1.empty ())
-        link.SetAttribute ("QueueSizeNode1", queueSizeNode1);
-      if (!queueSizeNode2.empty ())
-        link.SetAttribute ("QueueSizeNode2", queueSizeNode2);
+      if (!maxPackets.empty ())
+        link.SetAttribute ("MaxPackets", maxPackets);
 
       AddLink (link);
-      NS_LOG_DEBUG ("New link " << from << " <==> " << to << " / " << capacity << "Kbps with " << metric << " metric");
+      NS_LOG_DEBUG ("New link " << from << " <==> " << to << " / " << capacity << " with " << metric << " metric (" << delay << ", " << maxPackets << ")");
     }
         
   NS_LOG_INFO ("Annotated topology created with " << nodes.GetN () << " nodes and " << LinksSize () << " links");
@@ -253,37 +251,33 @@
       if (link.GetAttributeFailSafe ("DataRate", tmp))
         {
           NS_LOG_INFO ("DataRate = " + link.GetAttribute("DataRate"));
-          p2p.SetDeviceAttribute ("DataRate", StringValue(link.GetAttribute("DataRate")));
+          p2p.SetDeviceAttribute ("DataRate", StringValue (link.GetAttribute ("DataRate")));
         }
 
-      if (link.GetAttributeFailSafe("Delay", tmp))
+      if (link.GetAttributeFailSafe ("Delay", tmp))
         {
           NS_LOG_INFO ("Delay = " + link.GetAttribute("Delay"));
-          p2p.SetChannelAttribute ("Delay", StringValue(link.GetAttribute("Delay")));
+          p2p.SetChannelAttribute ("Delay", StringValue (link.GetAttribute ("Delay")));
         }
-        
+
       NetDeviceContainer nd = p2p.Install(link.GetFromNode (), link.GetToNode ());
       link.SetNetDevices (nd.Get (0), nd.Get (1));
 
-      if (link.GetAttributeFailSafe("QueueSizeNode1", tmp))
+      if (link.GetAttributeFailSafe ("MaxPackets", tmp))
         {
-          PointerValue txQueueFrom;
-          link.GetFromNetDevice ()->GetAttribute ("TxQueue", txQueueFrom);
-          NS_ASSERT (txQueueFrom.Get<DropTailQueue> () != 0);
+          NS_LOG_INFO ("MaxPackets = " + link.GetAttribute ("MaxPackets"));
 
-          NS_LOG_INFO ("QueueFrom: " << link.GetAttribute("QueueSizeNode1"));
-          txQueueFrom.Get<DropTailQueue> ()->SetAttribute ("MaxPackets", StringValue (link.GetAttribute("QueueSizeNode1")));
+          PointerValue txQueue;
+
+          link.GetToNetDevice ()->GetAttribute ("TxQueue", txQueue);
+          NS_ASSERT (txQueue.Get<DropTailQueue> () != 0);       
+          txQueue.Get<DropTailQueue> ()->SetAttribute ("MaxPackets", StringValue (link.GetAttribute ("MaxPackets")));
+
+          link.GetFromNetDevice ()->GetAttribute ("TxQueue", txQueue);
+          NS_ASSERT (txQueue.Get<DropTailQueue> () != 0);
+          txQueue.Get<DropTailQueue> ()->SetAttribute ("MaxPackets", StringValue (link.GetAttribute ("MaxPackets")));
         }
-      
-      if (link.GetAttributeFailSafe("QueueSizeNode2", tmp))
-        {
-          PointerValue txQueueTo;
-          link.GetToNetDevice ()->GetAttribute ("TxQueue", txQueueTo);
-          NS_ASSERT (txQueueTo.Get<DropTailQueue> () != 0);
         
-          NS_LOG_INFO ("QueueTo: " << link.GetAttribute("QueueSizeNode2"));
-          txQueueTo.Get<DropTailQueue> ()->SetAttribute ("MaxPackets", StringValue (link.GetAttribute("QueueSizeNode2")));
-        }
     }
 }
 
diff --git a/model/ccnx-bestroute-strategy.cc b/model/ccnx-bestroute-strategy.cc
index 776315f..2bbe287 100644
--- a/model/ccnx-bestroute-strategy.cc
+++ b/model/ccnx-bestroute-strategy.cc
@@ -86,6 +86,7 @@
       if (outgoing != pitEntry.m_outgoing.end () &&
           outgoing->m_retxCount >= pitEntry.m_maxRetxCount)
         {
+          NS_LOG_ERROR (outgoing->m_retxCount << " >= " << pitEntry.m_maxRetxCount);
           continue; // already forwarded before during this retransmission cycle
         }
 
diff --git a/model/ccnx-face.cc b/model/ccnx-face.cc
index 3e39384..18b2015 100644
--- a/model/ccnx-face.cc
+++ b/model/ccnx-face.cc
@@ -112,7 +112,7 @@
   
   if (m_bucketMax > 0)
     {
-      //NS_LOG_DEBUG ("Limits enabled: " << m_bucketMax << ", current: " << m_bucket);
+      NS_LOG_DEBUG ("Limits enabled: " << m_bucketMax << ", current: " << m_bucket);
       if (m_bucket+1.0 > m_bucketMax)
         {
           //NS_LOG_DEBUG ("Returning false");
diff --git a/model/ccnx-forwarding-strategy.cc b/model/ccnx-forwarding-strategy.cc
index d09d916..fbd4613 100644
--- a/model/ccnx-forwarding-strategy.cc
+++ b/model/ccnx-forwarding-strategy.cc
@@ -78,7 +78,7 @@
                                                    Ptr<CcnxInterestHeader> &header,
                                                    const Ptr<const Packet> &packet)
 {
-  // NS_LOG_FUNCTION (this);
+  NS_LOG_FUNCTION (this);
 
   int propagatedCount = 0;
   
@@ -97,6 +97,7 @@
       if (outgoing != pitEntry.m_outgoing.end () &&
           outgoing->m_retxCount >= pitEntry.m_maxRetxCount)
         {
+          NS_LOG_DEBUG ("retxCount: " << outgoing->m_retxCount << ", maxRetxCount: " << pitEntry.m_maxRetxCount);
           continue;
         }
       
diff --git a/model/ccnx-l3-protocol.cc b/model/ccnx-l3-protocol.cc
index 4e3e460..5b55906 100644
--- a/model/ccnx-l3-protocol.cc
+++ b/model/ccnx-l3-protocol.cc
@@ -76,7 +76,7 @@
     
     .AddAttribute ("BucketLeakInterval",
                    "Interval to leak buckets",
-                   StringValue ("10ms"),
+                   StringValue ("100ms"),
                    MakeTimeAccessor (&CcnxL3Protocol::GetBucketLeakInterval,
                                      &CcnxL3Protocol::SetBucketLeakInterval),
                    MakeTimeChecker ())
@@ -398,9 +398,11 @@
   // Lookup of Pit (and associated Fib) entry for this Interest 
   tuple<const CcnxPitEntry&,bool,bool> ret = m_pit->Lookup (*header);
   CcnxPitEntry const& pitEntry = ret.get<0> ();
-  // bool isNew = ret.get<1> ();
+  bool isNew = ret.get<1> ();
   bool isDuplicated = ret.get<2> ();
 
+  NS_LOG_DEBUG ("isNew: " << isNew << ", isDup: " << isDuplicated);
+  
   if (isDuplicated) 
     {
       m_dropInterests (header, DUPLICATED, incomingFace);
@@ -463,6 +465,8 @@
                      ll::var(inFace) = ll::bind (&CcnxPitEntry::AddIncoming, ll::_1, incomingFace));
     }
 
+  NS_LOG_DEBUG ("IsRetx: " << isRetransmitted);
+
   // update PIT entry lifetime
   m_pit->modify (m_pit->iterator_to (pitEntry),
                  ll::bind (&CcnxPitEntry::UpdateLifetime, ll::_1,
@@ -516,6 +520,7 @@
   // ForwardingStrategy failed to find it. 
   if (!propagated)
     {
+      NS_LOG_DEBUG ("Not propagated");
       m_dropInterests (header, NO_FACES, incomingFace);
       GiveUpInterest (pitEntry, header);
     }
@@ -620,6 +625,10 @@
   m_pit->modify (m_pit->iterator_to (pitEntry),
                  ll::bind (&CcnxPitEntry::ClearIncoming, ll::_1));
 
+  // Remove also outgoing
+  m_pit->modify (m_pit->iterator_to (pitEntry),
+                 ll::bind (&CcnxPitEntry::ClearOutgoing, ll::_1));
+  
   // Set pruning timout on PIT entry (instead of deleting the record)
   m_pit->modify (m_pit->iterator_to (pitEntry),
                  ll::bind (&CcnxPitEntry::SetExpireTime, ll::_1,
diff --git a/model/ccnx-pit-entry.cc b/model/ccnx-pit-entry.cc
index 76c7997..0cc6509 100644
--- a/model/ccnx-pit-entry.cc
+++ b/model/ccnx-pit-entry.cc
@@ -140,6 +140,7 @@
 void
 CcnxPitEntry::IncreaseAllowedRetxCount ()
 {
+  NS_LOG_ERROR (this);
   m_maxRetxCount++;
 }
 
diff --git a/model/ccnx-pit-entry.h b/model/ccnx-pit-entry.h
index c07eeda..12ffa91 100644
--- a/model/ccnx-pit-entry.h
+++ b/model/ccnx-pit-entry.h
@@ -195,6 +195,13 @@
   AddOutgoing (Ptr<CcnxFace> face);
 
   /**
+   * @brief Clear all incoming faces either after all of them were satisfied or NACKed
+   */
+  void
+  ClearOutgoing ()
+  { m_outgoing.clear (); }  
+  
+  /**
    * @brief Remove all references to face.
    * 
    * This method should be called before face is completely removed from the stack.