[Tinyos-2-commits] CVS: tinyos-2.x/tos/lib/net/collection ForwardingEngineP.nc, 1.1.2.47, 1.1.2.48

Phil Levis scipio at users.sourceforge.net
Wed Aug 2 14:13:31 PDT 2006


Update of /cvsroot/tinyos/tinyos-2.x/tos/lib/net/collection
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv451

Modified Files:
      Tag: tinyos-2_0_devel-BRANCH
	ForwardingEngineP.nc 
Log Message:
Bug fix from Jan Hauer pertaining to checking for duplicates in the queue.
If the queue size is 0, --i will decrement it to 255 and the loop will
run 255 times. Futhermore, as the queue does not have that many elements,
it will return NULL which can cause problems.



Index: ForwardingEngineP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/net/collection/ForwardingEngineP.nc,v
retrieving revision 1.1.2.47
retrieving revision 1.1.2.48
diff -C2 -d -r1.1.2.47 -r1.1.2.48
*** ForwardingEngineP.nc	28 Jun 2006 23:46:38 -0000	1.1.2.47
--- ForwardingEngineP.nc	2 Aug 2006 21:13:29 -0000	1.1.2.48
***************
*** 697,709 ****
      }
      //... and in the queue for duplicates
!     atomic {
!     	for (i = call SendQueue.size(); --i ;) {
!         	qe = call SendQueue.element(i);
! 	        if (call CollectionPacket.getPacketID(qe->msg) == msg_uid) {
!         	    duplicate = TRUE;
! 	            break;
!         	}
! 	    }
      }
      if (duplicate) {
          call CollectionDebug.logEvent(NET_C_FE_DUPLICATE_QUEUE);
--- 697,710 ----
      }
      //... and in the queue for duplicates
!     if (call SendQueue.size() > 0) {
!       for (i = call SendQueue.size(); --i;) {
! 	qe = call SendQueue.element(i);
! 	if (call CollectionPacket.getPacketID(qe->msg) == msg_uid) {
! 	  duplicate = TRUE;
! 	  break;
! 	}
!       }
      }
+     
      if (duplicate) {
          call CollectionDebug.logEvent(NET_C_FE_DUPLICATE_QUEUE);



More information about the Tinyos-2-commits mailing list