Make probing expiration time configurable
This commit is contained in:
parent
d1ec313081
commit
832a4d3e01
2 changed files with 15 additions and 5 deletions
|
@ -226,6 +226,15 @@
|
||||||
#define RPL_PROBING_INTERVAL (120 * CLOCK_SECOND)
|
#define RPL_PROBING_INTERVAL (120 * CLOCK_SECOND)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* RPL probing expiration time.
|
||||||
|
* */
|
||||||
|
#ifdef RPL_CONF_PROBING_EXPIRATION_TIME
|
||||||
|
#define RPL_PROBING_EXPIRATION_TIME RPL_CONF_PROBING_EXPIRATION_TIME
|
||||||
|
#else
|
||||||
|
#define RPL_PROBING_EXPIRATION_TIME (10 * 60 * CLOCK_SECOND)
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Function used to select the next parent to be probed.
|
* Function used to select the next parent to be probed.
|
||||||
* */
|
* */
|
||||||
|
|
|
@ -332,18 +332,19 @@ static rpl_parent_t *
|
||||||
get_probing_target(rpl_dag_t *dag)
|
get_probing_target(rpl_dag_t *dag)
|
||||||
{
|
{
|
||||||
/* Returns the next probing target. The current implementation probes the current
|
/* Returns the next probing target. The current implementation probes the current
|
||||||
* preferred parent if we have not updated its link for 2 * RPL_PROBING_INTERVAL.
|
* preferred parent if we have not updated its link for RPL_PROBING_EXPIRATION_TIME.
|
||||||
* Otherwise, it picks at random between:
|
* Otherwise, it picks at random between:
|
||||||
* (1) selecting the best parent not updated for 2 * RPL_PROBING_INTERVAL
|
* (1) selecting the best parent not updated for RPL_PROBING_EXPIRATION_TIME
|
||||||
* (2) selecting the least recently updated parent
|
* (2) selecting the least recently updated parent
|
||||||
*/
|
*/
|
||||||
|
|
||||||
rpl_parent_t *p;
|
rpl_parent_t *p;
|
||||||
rpl_parent_t *probing_target = NULL;
|
rpl_parent_t *probing_target = NULL;
|
||||||
rpl_rank_t probing_target_rank = INFINITE_RANK;
|
rpl_rank_t probing_target_rank = INFINITE_RANK;
|
||||||
/* min_last_tx is the clock time (2 * RPL_PROBING_INTERVAL) in the past */
|
/* min_last_tx is the clock time RPL_PROBING_EXPIRATION_TIME in the past */
|
||||||
clock_time_t min_last_tx = clock_time();
|
clock_time_t min_last_tx = clock_time();
|
||||||
min_last_tx = min_last_tx > 2 * RPL_PROBING_INTERVAL ? min_last_tx - 2 * RPL_PROBING_INTERVAL : 1;
|
min_last_tx = min_last_tx > 2 * RPL_PROBING_EXPIRATION_TIME
|
||||||
|
? min_last_tx - RPL_PROBING_EXPIRATION_TIME : 1;
|
||||||
|
|
||||||
if(dag == NULL ||
|
if(dag == NULL ||
|
||||||
dag->instance == NULL ||
|
dag->instance == NULL ||
|
||||||
|
@ -357,7 +358,7 @@ get_probing_target(rpl_dag_t *dag)
|
||||||
}
|
}
|
||||||
|
|
||||||
if((random_rand() % 2) == 0) {
|
if((random_rand() % 2) == 0) {
|
||||||
/* With 1/2 probability: probe best parent not updated for 2 * RPL_PROBING_INTERVAL */
|
/* With 1/2 probability: probe best parent not updated for RPL_PROBING_EXPIRATION_TIME */
|
||||||
p = nbr_table_head(rpl_parents);
|
p = nbr_table_head(rpl_parents);
|
||||||
while(p != NULL) {
|
while(p != NULL) {
|
||||||
if(p->dag == dag && p->last_tx_time < min_last_tx) {
|
if(p->dag == dag && p->last_tx_time < min_last_tx) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue