Skip to content

Commit 15846ed

Browse files
refactored network data sync as leader (#1615)
added reattach logic for REED when it fails to get data response.
1 parent a5c67fd commit 15846ed

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

source/6LoWPAN/Thread/thread_bootstrap.c

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1660,9 +1660,21 @@ bool thread_network_data_timeout(int8_t interface_id, uint16_t msgId, bool usedA
16601660
return true;
16611661
}
16621662

1663-
if(cur->thread_info->leader_synced && !usedAllRetries){
1664-
tr_debug("retrying as leader data not yet synced");
1665-
return true;
1663+
if(cur->thread_info->leader_synced) {
1664+
if(usedAllRetries) {
1665+
// could not learn network data from neighbour, everyone must reregister
1666+
cur->thread_info->leader_synced = false;
1667+
thread_leader_service_network_data_changed(cur,true,true);
1668+
return false;
1669+
} else {
1670+
tr_debug("retrying as leader data not yet synced");
1671+
return true;
1672+
}
1673+
}
1674+
1675+
// if REED fails to get updated network data, it reattaches
1676+
if (thread_info(cur)->networkDataRequested && !thread_attach_active_router(cur) && usedAllRetries) {
1677+
thread_bootstrap_reset_restart(interface_id);
16661678
}
16671679

16681680
thread_info(cur)->networkDataRequested = false;

test/nanostack/unittest/stub/thread_leader_service_stub.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,6 @@ uint16_t thread_leader_service_child_id_from_networkdata_get(struct thread_info_
8080
void thread_leader_service_thread_partitition_generate(int8_t interface_id, bool newPartition)
8181
{
8282
}
83+
void thread_leader_service_network_data_changed(protocol_interface_info_entry_t *cur, bool force_stable_update, bool force_unstable_update)
84+
{
85+
}

0 commit comments

Comments
 (0)