Skip to content

Commit

Permalink
Additional time for distribution of dataset added (ARMmbed#1892)
Browse files Browse the repository at this point in the history
This reduces the possibility of routers changing state 
before distributing updated settings.
  • Loading branch information
deepakvenugopal authored Nov 2, 2018
1 parent dde9e61 commit 399f02f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
3 changes: 3 additions & 0 deletions source/6LoWPAN/Thread/thread_joiner_application.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
#include "thread_management_if.h"
#include "thread_common.h"
#include "thread_bootstrap.h"
#include "thread_router_bootstrap.h"
#include "thread_network_synch.h"
#include "thread_network_data_lib.h"
#include "thread_joiner_application.h"
Expand Down Expand Up @@ -1922,6 +1923,8 @@ int thread_joiner_application_update_configuration(uint8_t interface_id, uint8_t
}
thread_meshcop_tlv_data_get_uint64(msg_ptr, msg_len, MESHCOP_TLV_ACTIVE_TIME_STAMP, &this->active_configuration_ptr->timestamp);
link_configuration_update(this->configuration_ptr,msg_ptr,msg_len);
// allow 5 seconds delay before state change for data response propagation
thread_router_bootstrap_delay_reed_jitter(interface_id, 5);
ns_dyn_mem_free(configuration_ptr);
thread_joiner_application_configuration_nvm_save(interface_id);

Expand Down
14 changes: 14 additions & 0 deletions source/6LoWPAN/Thread/thread_router_bootstrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -2782,4 +2782,18 @@ void thread_router_bootstrap_address_change_notify_send(protocol_interface_info_
thread_info(cur)->proactive_an_timer = THREAD_PROACTIVE_AN_SEND_DELAY;
}

void thread_router_bootstrap_delay_reed_jitter(int8_t interface_id, uint16_t delay)
{
protocol_interface_info_entry_t *cur = protocol_stack_interface_info_get_by_id(interface_id);
if (!cur) {
return;
}
if (cur->thread_info->thread_device_mode != THREAD_DEVICE_MODE_ROUTER) {
return;
}
// delay reed jitter timer to allow for settings changes to distribute
thread_info(cur)->reedJitterTimer += delay;
return;
}

#endif /* HAVE_THREAD_ROUTER */
3 changes: 2 additions & 1 deletion source/6LoWPAN/Thread/thread_router_bootstrap.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ void thread_router_bootstrap_anycast_address_register(protocol_interface_info_en
void thread_router_bootstrap_network_data_distribute(protocol_interface_info_entry_t *cur);
bool thread_router_bootstrap_routing_allowed(struct protocol_interface_info_entry *cur);
void thread_router_bootstrap_address_change_notify_send(protocol_interface_info_entry_t *cur);
void thread_router_bootstrap_delay_reed_jitter(int8_t interface_id, uint16_t delay);

#else

Expand Down Expand Up @@ -108,7 +109,7 @@ void thread_router_bootstrap_address_change_notify_send(protocol_interface_info_
#define thread_router_bootstrap_routing_allowed(cur) false
#define thread_router_bootstrap_address_change_notify_send(cur)
#define thread_router_bootstrap_reed_merge_advertisement(cur)

#define thread_router_bootstrap_delay_reed_jitter(interface_id, delay)
#endif/*HAVE_THREAD_ROUTER*/

#endif /* THREAD_ROUTER_BOOTSTRAP_H_ */

0 comments on commit 399f02f

Please sign in to comment.