]> oss.titaniummirror.com Git - tinyos-2.x.git/blobdiff - tos/lib/net/Deluge/ObjectTransferP.nc
Add image verification at boot time. To make this possible I had to reintroduce the...
[tinyos-2.x.git] / tos / lib / net / Deluge / ObjectTransferP.nc
index d2c2d820cfd1ee3d6f4020f6f0c094c6e1d42d55..88878217f8e78b8e53f2af6bc7e0475083e86a78 100644 (file)
@@ -130,8 +130,10 @@ implementation
   
   void sendAdvMsg(uint16_t addr)
   {
-    DelugeAdvMsg *pMsg = (DelugeAdvMsg *)(call SendAdvMsg.getPayload(&pMsgBuf));
-    
+    DelugeAdvMsg *pMsg = (DelugeAdvMsg *)(call SendAdvMsg.getPayload(&pMsgBuf, sizeof(DelugeAdvMsg)));
+    if (pMsg == NULL) {
+      return;
+    }
     if (isBusy_pMsgBuf == FALSE) {
       pMsg->sourceAddr = TOS_NODE_ID;
       pMsg->version = DELUGE_VERSION;
@@ -168,7 +170,7 @@ implementation
     
     state = S_INITIALIZING_PUB;
     curObjDesc.objid = new_objid;
-    curObjDesc.numPgs = ((new_size - 1) / DELUGE_BYTES_PER_PAGE) + 1;   // Number of pages to transmit
+    curObjDesc.numPgs = ((new_size - 1) / DELUGET2_BYTES_PER_PAGE) + 1;   // Number of pages to transmit
     curObjDesc.numPgsComplete = curObjDesc.numPgs;   // Publisher doesn't really care about this
     curObjDesc.crc = call Crc.crc16(&curObjDesc, sizeof(object_id_t) + sizeof(page_num_t));
     
@@ -189,7 +191,7 @@ implementation
   void cont_receive() {
     state = S_INITIALIZING_RECV;
     curObjDesc.objid = cont_receive_new_objid;
-    curObjDesc.numPgs = ((cont_receive_new_size - 1) / DELUGE_BYTES_PER_PAGE) + 1;   // Number of pages to receive
+    curObjDesc.numPgs = ((cont_receive_new_size - 1) / DELUGET2_BYTES_PER_PAGE) + 1;   // Number of pages to receive
     curObjDesc.numPgsComplete = 0;
     curObjDesc.crc = call Crc.crc16(&curObjDesc, sizeof(object_id_t) + sizeof(page_num_t));