replace a buggy assert with a check with warning.
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Tue, 20 Nov 2007 12:48:51 +0100
changeset 2148 4c9b6134023a
parent 2147 b6243a53c93f
child 2149 6bf08d8a8eff
replace a buggy assert with a check with warning.
src/devices/wifi/mac-rx-middle.cc
--- a/src/devices/wifi/mac-rx-middle.cc	Mon Nov 19 16:54:04 2007 +0100
+++ b/src/devices/wifi/mac-rx-middle.cc	Tue Nov 20 12:48:51 2007 +0100
@@ -265,8 +265,19 @@
   OriginatorRxStatus *originator = Lookup (hdr);
   if (hdr->IsData ()) 
     {
-      NS_ASSERT (SequenceControlSmaller (originator->GetLastSequenceControl (), 
-                                         hdr->GetSequenceControl ()));
+      /**
+       * Note that the check below is not deterministic: it is possible
+       * for sequence numbers to loop back to zero once they reach 0xfff0
+       * and to go up to 0xf7f0 in which case the check below will report the
+       * two sequence numbers to not have the correct order relationship.
+       * This is why this check generates a warning only.
+       */
+      if (!SequenceControlSmaller (originator->GetLastSequenceControl (), 
+                                   hdr->GetSequenceControl ()))
+        {
+          NS_LOG_UNCOND ("Sequence numbers have looped back. last recorded="<<originator->GetLastSequenceControl ()<<
+                         " currently seen="<< hdr->GetSequenceControl ());
+        }
       // filter duplicates.
       if (IsDuplicate (hdr, originator)) 
         {