Merge remote-tracking branch 'git.irl/master'
diff --git a/model/ccnx-face.cc b/model/ccnx-face.cc
index a1dec50..ba9e4ec 100644
--- a/model/ccnx-face.cc
+++ b/model/ccnx-face.cc
@@ -29,6 +29,7 @@
 #include "ns3/double.h"
 #include "ns3/boolean.h"
 #include "ns3/simulator.h"
+#include "ns3/random-variable.h"
 
 // #include "ns3/weights-path-stretch-tag.h"
 
@@ -60,6 +61,11 @@
                    DoubleValue (0.0),
                    MakeDoubleAccessor (&CcnxFace::m_bucketLeak),
                    MakeDoubleChecker<double> ())
+
+    .AddAttribute ("RandomizeLimitChecking", "Whether or not to randomize the limit checking procedure. false (persistent) by default",
+                   BooleanValue (false),
+                   MakeBooleanAccessor (&CcnxFace::m_randomizeLimitChecking),
+                   MakeBooleanChecker ())
                    
     // .AddAttribute ("MetricTagging", "Enable metric tagging (path-stretch calculation)",
     //                BooleanValue (false),
@@ -148,10 +154,30 @@
           //NS_LOG_DEBUG ("Returning false");
           return false;
         }
-      
-      m_bucket += 1.0;
-    }
 
+      if (m_randomizeLimitChecking)
+        {
+          static NormalVariable acceptanceProbability (m_bucketMax, m_bucketMax/6.0, m_bucketMax/2.0);
+          // static UniformVariable acceptanceProbability (0, m_bucketMax);
+          double value = acceptanceProbability.GetValue ();
+          if (value > m_bucketMax)
+            value -= m_bucketMax;
+      
+          if (m_bucket < value)
+            {
+              m_bucket += 1.0;
+              return true;
+            }
+          else
+            return false;
+        }
+      else
+        {
+          m_bucket += 1.0;
+          return true;
+        }
+    }
+  
   return true;
 }
 
diff --git a/model/ccnx-face.h b/model/ccnx-face.h
index 4a0cdf9..25b0082 100644
--- a/model/ccnx-face.h
+++ b/model/ccnx-face.h
@@ -246,6 +246,7 @@
   uint32_t m_id; ///< \brief id of the interface in CCNx stack (per-node uniqueness)
   Time m_lastLeakTime;
   uint32_t m_metric; ///< \brief metric of the face
+  bool m_randomizeLimitChecking;
 
   // bool m_enableMetricTagging;
 
diff --git a/model/forwarding-strategy/fw-stats.h b/model/forwarding-strategy/fw-stats.h
index 67f2763..69149f3 100644
--- a/model/forwarding-strategy/fw-stats.h
+++ b/model/forwarding-strategy/fw-stats.h
@@ -46,6 +46,10 @@
    */
   FwStats ();
 
+  inline
+  const ::ndnSIM::StatsTree &
+  GetStatsTree () const;  
+
   virtual void
   OnInterest (const Ptr<CcnxFace> &face,
               Ptr<CcnxInterestHeader> &header,
@@ -112,6 +116,12 @@
   typedef BestRoute super;
 };
 
+const ::ndnSIM::StatsTree &
+FwStats::GetStatsTree () const
+{
+  return m_stats;
+}
+
 } // namespace ndnSIM
 } // namespace ns3
 
diff --git a/plugins/topology/annotated-topology-reader.cc b/plugins/topology/annotated-topology-reader.cc
index 7b68046..9dcbc9d 100644
--- a/plugins/topology/annotated-topology-reader.cc
+++ b/plugins/topology/annotated-topology-reader.cc
@@ -285,7 +285,8 @@
 AnnotatedTopologyReader::ApplySettings ()
 {
 #ifdef NS3_MPI
-  if (MpiInterface::GetSize () != m_requiredPartitions)
+  if (MpiInterface::IsEnabled () &&
+      MpiInterface::GetSize () != m_requiredPartitions)
     {
       std::cerr << "MPI interface is enabled, but number of partitions (" << MpiInterface::GetSize ()
                 << ") is not equal to number of partitions in the topology (" << m_requiredPartitions << ")";