Skip to content

Commit

Permalink
refactored network data sync as leader (ARMmbed#1615)
Browse files Browse the repository at this point in the history
added reattach logic for REED when it fails
to get data response.
  • Loading branch information
deepakvenugopal authored Mar 12, 2018
1 parent a5c67fd commit 15846ed
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
18 changes: 15 additions & 3 deletions source/6LoWPAN/Thread/thread_bootstrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1660,9 +1660,21 @@ bool thread_network_data_timeout(int8_t interface_id, uint16_t msgId, bool usedA
return true;
}

if(cur->thread_info->leader_synced && !usedAllRetries){
tr_debug("retrying as leader data not yet synced");
return true;
if(cur->thread_info->leader_synced) {
if(usedAllRetries) {
// could not learn network data from neighbour, everyone must reregister
cur->thread_info->leader_synced = false;
thread_leader_service_network_data_changed(cur,true,true);
return false;
} else {
tr_debug("retrying as leader data not yet synced");
return true;
}
}

// if REED fails to get updated network data, it reattaches
if (thread_info(cur)->networkDataRequested && !thread_attach_active_router(cur) && usedAllRetries) {
thread_bootstrap_reset_restart(interface_id);
}

thread_info(cur)->networkDataRequested = false;
Expand Down
3 changes: 3 additions & 0 deletions test/nanostack/unittest/stub/thread_leader_service_stub.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,6 @@ uint16_t thread_leader_service_child_id_from_networkdata_get(struct thread_info_
void thread_leader_service_thread_partitition_generate(int8_t interface_id, bool newPartition)
{
}
void thread_leader_service_network_data_changed(protocol_interface_info_entry_t *cur, bool force_stable_update, bool force_unstable_update)
{
}

0 comments on commit 15846ed

Please sign in to comment.