]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
Refresh link when MH packet received
authorstrabest <strabest>
Mon, 3 Nov 2008 21:30:21 +0000 (21:30 +0000)
committerstrabest <strabest>
Mon, 3 Nov 2008 21:30:21 +0000 (21:30 +0000)
tos/lib/net/tymo/ForwardingEngineM.nc
tos/lib/net/tymo/LinkMonitor.nc
tos/lib/net/tymo/dymo/DymoTableM.nc

index 15d1499c31ad534d8e527eba5ec14203ff4607ce..65662d186231c4c8a2e846ad60448da3f8986555 100644 (file)
@@ -137,6 +137,8 @@ implementation {
        dbg("fwe", "FE: The message was not acked => FAIL.\n");
        signal MHControl.sendFailed(msg, 2);
        signal LinkMonitor.brokenLink(call AMPacket.destination(msg));
+      } else {
+        signal LinkMonitor.refreshedLink(call AMPacket.destination(msg));
       }
     } else if (e != SUCCESS) {
       dbg("fwe", "FE: ...but failed!\n");
index fd86277ecb2c618c6fbc2e8068d98255ccb368d1..b03ca4df37b709a5837f94cc2fc84944b1c6dfe5 100644 (file)
@@ -6,7 +6,7 @@
 #include "AM.h"
 
 /**
- * LinkMonitor - Interface to signals broken links in the neighborhood.
+ * LinkMonitor - Interface to signals broken and used links in the neighborhood.
  *
  * @author Romain Thouvenin
  */
@@ -15,4 +15,6 @@ interface LinkMonitor {
 
   event void brokenLink(am_addr_t neighbor);
 
+  event void refreshedLink(am_addr_t neighbor);
+
 }
index d0e00dd8610b62fadc26219c5dbbde01d7c39c28..7467d3c793c0ede5cd2e2aca7ef480b63631d2b8 100644 (file)
@@ -252,6 +252,13 @@ implementation {
     }
   }
 
+  event void LinkMonitor.refreshedLink(addr_t neighbor) {
+    int8_t i = get_route(neighbor);
+    if (i != -1) {
+      replace_info(i, &table[i].info);
+    }
+  }
+
   void replace_info(uint8_t pos, const rt_info_t * route_info){
     table[pos].info = *route_info;
     table[pos].flags = FLAG_NEW;