[Tinyos-beta-commits]
CVS: tinyos-1.x/beta/Drain/tools/java/net/tinyos/drain
DrainConnector.java, 1.6, 1.7
Kamin Whitehouse
kaminw at users.sourceforge.net
Wed Sep 28 20:10:38 PDT 2005
Update of /cvsroot/tinyos/tinyos-1.x/beta/Drain/tools/java/net/tinyos/drain
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7807
Modified Files:
DrainConnector.java
Log Message:
added duplicate packet rejection to the pc-side drain tool. Because dup-rejection is not in the nodes, a message can go down the drain tree multiple times, which is costly. However, at least it cannot make it into the pc-side tools multiple times to screw w/ state machines, etc. Adding duplicate packet rejection on the nodes will be somewhat costly in terms of ram because we need to keep state for (ideally) all ancestors in the tree, so for now lets just do with this.
Index: DrainConnector.java
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/Drain/tools/java/net/tinyos/drain/DrainConnector.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** DrainConnector.java 20 Jul 2005 17:10:08 -0000 1.6
--- DrainConnector.java 29 Sep 2005 03:10:36 -0000 1.7
***************
*** 23,26 ****
--- 23,27 ----
private int spAddr;
+ private Hashtable seqNos = new Hashtable();
private HashMap idTable = new HashMap();
***************
*** 63,69 ****
--- 64,84 ----
" type:" + mhMsg.get_type() +
" hops:" + (16 - mhMsg.get_ttl()) +
+ " seqNo:" + mhMsg.get_seqNo() +
" source:" + mhMsg.get_source() +
" finalDest:" + mhMsg.get_dest());
+ //lets assume that the network cannot buffer more than 25 drain msgs from a single source at a time (should be more than reasonable)
+ if (seqNos.containsKey(new Integer(mhMsg.get_source()))){
+ int oldSeqNo = ((Integer)seqNos.get(new Integer(mhMsg.get_source()))).intValue();
+ int upperBound = mhMsg.get_seqNo()+25;
+ int wrappedUpperBound = 25 - (255- mhMsg.get_seqNo());
+ if ( (oldSeqNo >= mhMsg.get_seqNo() && oldSeqNo < upperBound) ||
+ (oldSeqNo >= 0 && oldSeqNo < wrappedUpperBound) ) {
+ log.debug("Dropping message from " + mhMsg.get_source() + " with duplicate seqNo: " + mhMsg.get_seqNo());
+ return;
+ }
+ }
+ seqNos.put(new Integer(mhMsg.get_source()), new Integer(mhMsg.get_seqNo()));
+
if (to != spAddr && to != MoteIF.TOS_BCAST_ADDR && to != TOS_UART_ADDR) {
log.debug("Dropping message not for me.");
More information about the Tinyos-beta-commits
mailing list