RPL non-storing mode: increase routing state lifetime by one period (60s) so as to ensure no link espired before its avertised lifetime

This commit is contained in:
Simon Duquennoy 2017-11-12 14:05:29 +01:00 committed by Simon Duquennoy
parent 5449401d57
commit cbdc3e4569
2 changed files with 20 additions and 16 deletions

View File

@ -203,14 +203,8 @@ void
rpl_ns_periodic(void) rpl_ns_periodic(void)
{ {
rpl_ns_node_t *l; rpl_ns_node_t *l;
/* First pass, decrement lifetime for all nodes with non-infinite lifetime */
for(l = list_head(nodelist); l != NULL; l = list_item_next(l)) { /* First pass, for all expired nodes, deallocate them iff no child points to them */
/* Don't touch infinite lifetime nodes */
if(l->lifetime != 0xffffffff && l->lifetime > 0) {
l->lifetime--;
}
}
/* Second pass, for all expired nodes, deallocate them iff no child points to them */
for(l = list_head(nodelist); l != NULL; l = list_item_next(l)) { for(l = list_head(nodelist); l != NULL; l = list_item_next(l)) {
if(l->lifetime == 0) { if(l->lifetime == 0) {
rpl_ns_node_t *l2; rpl_ns_node_t *l2;
@ -225,6 +219,14 @@ rpl_ns_periodic(void)
num_nodes--; num_nodes--;
} }
} }
/* Second pass, decrement lifetime for all nodes with non-infinite lifetime */
for(l = list_head(nodelist); l != NULL; l = list_item_next(l)) {
/* Don't touch infinite lifetime nodes */
if(l->lifetime != 0xffffffff && l->lifetime > 0) {
l->lifetime--;
}
}
} }
#endif /* RPL_WITH_NON_STORING */ #endif /* RPL_WITH_NON_STORING */

View File

@ -207,14 +207,8 @@ rpl_ns_periodic(unsigned seconds)
{ {
rpl_ns_node_t *l; rpl_ns_node_t *l;
rpl_ns_node_t *next; rpl_ns_node_t *next;
/* First pass, decrement lifetime for all nodes with non-infinite lifetime */
for(l = list_head(nodelist); l != NULL; l = list_item_next(l)) { /* First pass, for all expired nodes, deallocate them iff no child points to them */
/* Don't touch infinite lifetime nodes */
if(l->lifetime != RPL_ROUTE_INFINITE_LIFETIME) {
l->lifetime = l->lifetime > seconds ? l->lifetime - seconds : 0;
}
}
/* Second pass, for all expired nodes, deallocate them iff no child points to them */
for(l = list_head(nodelist); l != NULL; l = next) { for(l = list_head(nodelist); l != NULL; l = next) {
next = list_item_next(l); next = list_item_next(l);
if(l->lifetime == 0) { if(l->lifetime == 0) {
@ -237,6 +231,14 @@ rpl_ns_periodic(unsigned seconds)
num_nodes--; num_nodes--;
} }
} }
/* Second pass, decrement lifetime for all nodes with non-infinite lifetime */
for(l = list_head(nodelist); l != NULL; l = list_item_next(l)) {
/* Don't touch infinite lifetime nodes */
if(l->lifetime != RPL_ROUTE_INFINITE_LIFETIME) {
l->lifetime = l->lifetime > seconds ? l->lifetime - seconds : 0;
}
}
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
void void