[Tinyos-2-commits] CVS: tinyos-2.x/tos/lib/net/dip DipLogicP.nc, 1.1, 1.2 DipSummaryP.nc, 1.1, 1.2

Kaisen Lin kaisenl at users.sourceforge.net
Tue Jul 14 10:14:56 PDT 2009


Update of /cvsroot/tinyos/tinyos-2.x/tos/lib/net/dip
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv21213

Modified Files:
	DipLogicP.nc DipSummaryP.nc 
Log Message:
Memory Fixes

Index: DipLogicP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/net/dip/DipLogicP.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** DipLogicP.nc	3 Jan 2008 21:30:35 -0000	1.1
--- DipLogicP.nc	14 Jul 2009 17:14:54 -0000	1.2
***************
*** 70,74 ****
--- 70,76 ----
      dbg("DipLogicP","App notified key %x is new\n", key);
      i = call DipHelp.keyToIndex(key);
+ #ifndef DIP_JOINTEST
      estimates[i] = DIP_DATA_ESTIMATE;
+ #endif
      call VersionUpdate.change[key](val);
      call DipTrickleTimer.reset();

Index: DipSummaryP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/net/dip/DipSummaryP.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** DipSummaryP.nc	3 Jan 2008 21:30:35 -0000	1.1
--- DipSummaryP.nc	14 Jul 2009 17:14:54 -0000	1.2
***************
*** 51,54 ****
--- 51,57 ----
  
      dmsg = (dip_msg_t*) call SummarySend.getPayloadPtr();
+     if(dmsg == NULL) {
+       return FAIL;
+     }
      dmsg->type = ID_DIP_SUMMARY;
      dsmsg = (dip_summary_msg_t*) dmsg->content;
***************
*** 106,109 ****
--- 109,115 ----
        splitRange(dsmsg->info[i], &left, &right);
        myHash = computeHash(left, right, allVers, salt);
+       //dbg("DipSummaryP", "Received Range: %u, %u\n", left, right);
+       //dbg("DipSummaryP", "Received Hash: %08x\n", dsmsg->info[i+1]);
+       //dbg("DipSummaryP", "My Hash: %08x\n", myHash);
        if(myHash != dsmsg->info[i+1]) {
  	// hashes don't match
***************
*** 149,153 ****
      if(highIndex < len - 1) { LBound = 0; }
      else { LBound = highIndex - len + 1; }
!     if(LBound + len > UQCOUNT_DIP) { RBound = UQCOUNT_DIP; }
      else { RBound = highIndex + len; }
  
--- 155,159 ----
      if(highIndex < len - 1) { LBound = 0; }
      else { LBound = highIndex - len + 1; }
!     if(highIndex + len > UQCOUNT_DIP) { RBound = UQCOUNT_DIP; }
      else { RBound = highIndex + len; }
  
***************
*** 167,174 ****
      // iterate through the range
      runEstSum = highEstSum;
!     dbg("DipSummaryP", "Iterating from %u to %u\n", LBound, RBound);
!     for(i = LBound ; i + len <= RBound; i++) {
        est1 = shadowEstimates[i];
        est2 = shadowEstimates[i + len];
        runEstSum = runEstSum - est1 + est2;
        // dbg("Dissemination","Next sum: %u\n", runEstSum);
--- 173,183 ----
      // iterate through the range
      runEstSum = highEstSum;
!     dbg("DipSummaryP", "Iterating from %u to %u with len %u\n", LBound, RBound, len);
! 
!     for(i = LBound ; i + len < RBound; i++) {
        est1 = shadowEstimates[i];
        est2 = shadowEstimates[i + len];
+       //dbg("DipSummaryP", "i: %u\n", i);
+       //dbg("DipSummaryP", "i+len: %u\n", i+len);
        runEstSum = runEstSum - est1 + est2;
        // dbg("Dissemination","Next sum: %u\n", runEstSum);
***************
*** 184,187 ****
--- 193,197 ----
      *left = highIndex;
      *right = highIndex + len;
+     dbg("DipSummaryP","Final Range: %u, %u\n", *left, *right);
    }
  
***************
*** 197,206 ****
      dip_index_t i;
      uint32_t hashValue = salt;
!     uint8_t *sequence; 
  
      if(right <= left) return 0;
!     sequence = ((uint8_t*) (basedata + left));
  
!     for(i = 0; i <= (right-left-1)*sizeof(dip_version_t); i++) {
        hashValue += sequence[i];
        hashValue += (hashValue << 10);
--- 207,223 ----
      dip_index_t i;
      uint32_t hashValue = salt;
!     //uint8_t *sequence;
!     dip_version_t* sequence;
!     uint32_t iterations;
  
      if(right <= left) return 0;
!     //sequence = ((uint8_t*) (basedata + left));
!     sequence = (basedata + left);
!     //iterations = (right - left - 1)*sizeof(dip_version_t);
!     iterations = (right - left - 1);
  
!     //dbg("DipSummaryP","Computing hash for %u, %u for %u iters\n", left, right,  iterations);
! 
!     for(i = 0; i <= iterations; i++) {
        hashValue += sequence[i];
        hashValue += (hashValue << 10);
***************
*** 225,228 ****
--- 242,246 ----
        indexSeqPair[1] = basedata[i];
        bit = computeHash(0, 2, indexSeqPair, salt) % 32;
+       //dbg("DipSummaryP", "Bloom Hash: %u, %u, %u\n", indexSeqPair[0], indexSeqPair[1], bit);
        returnHash |= (1 << bit);
      }



More information about the Tinyos-2-commits mailing list