apps+utils: Correcting Interest-Delay tracing
diff --git a/apps/ndn-consumer-zipf-mandelbrot.cc b/apps/ndn-consumer-zipf-mandelbrot.cc
index 645ba11..c0e84d8 100644
--- a/apps/ndn-consumer-zipf-mandelbrot.cc
+++ b/apps/ndn-consumer-zipf-mandelbrot.cc
@@ -165,7 +165,13 @@
   NS_LOG_DEBUG ("Trying to add " << seq << " with " << Simulator::Now () << ". already " << m_seqTimeouts.size () << " items");
 
   m_seqTimeouts.insert (SeqTimeout (seq, Simulator::Now ()));
-  m_seqLifetimes.insert (SeqTimeout (seq, Simulator::Now ()));
+  m_seqFullDelay.insert (SeqTimeout (seq, Simulator::Now ()));
+
+  m_seqLastDelay.erase (seq);
+  m_seqLastDelay.insert (SeqTimeout (seq, Simulator::Now ()));
+
+  m_seqRetxCounts[seq] ++;
+  
   m_transmittedInterests (&interestHeader, this, m_face);
 
   m_rtt->SentSeq (SequenceNumber32 (seq), 1);
diff --git a/apps/ndn-consumer.cc b/apps/ndn-consumer.cc
index e71a5f4..08d4b2c 100644
--- a/apps/ndn-consumer.cc
+++ b/apps/ndn-consumer.cc
@@ -217,7 +217,12 @@
   NS_LOG_DEBUG ("Trying to add " << seq << " with " << Simulator::Now () << ". already " << m_seqTimeouts.size () << " items");  
   
   m_seqTimeouts.insert (SeqTimeout (seq, Simulator::Now ()));
-  m_seqLifetimes.insert (SeqTimeout (seq, Simulator::Now ()));
+  m_seqFullDelay.insert (SeqTimeout (seq, Simulator::Now ()));
+
+  m_seqLastDelay.erase (seq);
+  m_seqLastDelay.insert (SeqTimeout (seq, Simulator::Now ()));
+
+  m_seqRetxCounts[seq] ++;
   
   m_transmittedInterests (&interestHeader, this, m_face);
 
@@ -248,19 +253,22 @@
   uint32_t seq = boost::lexical_cast<uint32_t> (contentObject->GetName ().GetComponents ().back ());
   NS_LOG_INFO ("< DATA for " << seq);
 
-  SeqTimeoutsContainer::iterator entry = m_seqTimeouts.find (seq);
-  if (entry != m_seqTimeouts.end ())
+  SeqTimeoutsContainer::iterator entry = m_seqLastDelay.find (seq);
+  if (entry != m_seqLastDelay.end ())
     {
       m_lastRetransmittedInterestDataDelay (this, seq, Simulator::Now () - entry->time);
     }
 
-  entry = m_seqLifetimes.find (seq);
-  if (entry != m_seqLifetimes.end ())
+  entry = m_seqFullDelay.find (seq);
+  if (entry != m_seqFullDelay.end ())
     {
-      m_firstInterestDataDelay (this, seq, Simulator::Now () - entry->time);
+      m_firstInterestDataDelay (this, seq, Simulator::Now () - entry->time, m_seqRetxCounts[seq]);
     }
+
+  m_seqRetxCounts.erase (seq);  
+  m_seqFullDelay.erase (seq);
+  m_seqLastDelay.erase (seq);
   
-  m_seqLifetimes.erase (seq);
   m_seqTimeouts.erase (seq);
   m_retxSeqs.erase (seq);
 
diff --git a/apps/ndn-consumer.h b/apps/ndn-consumer.h
index 7fd8877..03c3dd9 100644
--- a/apps/ndn-consumer.h
+++ b/apps/ndn-consumer.h
@@ -31,6 +31,7 @@
 //#include "ns3/internet-module.h"
 
 #include <set>
+#include <map>
 
 #include <boost/multi_index_container.hpp>
 #include <boost/multi_index/tag.hpp>
@@ -175,11 +176,14 @@
     > { } ;
 
   SeqTimeoutsContainer m_seqTimeouts;       ///< \brief multi-index for the set of SeqTimeout structs
-  SeqTimeoutsContainer m_seqLifetimes;
+
+  SeqTimeoutsContainer m_seqLastDelay;
+  SeqTimeoutsContainer m_seqFullDelay;
+  std::map<uint32_t, uint32_t> m_seqRetxCounts;
   
   TracedCallback<Ptr<Node>, Ptr<Node>, uint32_t, uint32_t > m_pathWeightsTrace;
   TracedCallback<Ptr<App> /* app */, uint32_t /* seqno */, Time /* delay */> m_lastRetransmittedInterestDataDelay;
-  TracedCallback<Ptr<App> /* app */, uint32_t /* seqno */, Time /* delay */> m_firstInterestDataDelay;
+  TracedCallback<Ptr<App> /* app */, uint32_t /* seqno */, Time /* delay */, uint32_t /*retx count*/> m_firstInterestDataDelay;
   
 /// @endcond
 };