Skip to content

Commit 5af4a39

Browse files
updated mleid rloc sync in leader. (#1645)
1 parent 564d3fe commit 5af4a39

File tree

4 files changed

+16
-3
lines changed

4 files changed

+16
-3
lines changed

source/6LoWPAN/Thread/thread_common.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ int8_t thread_bootstrap_down(protocol_interface_info_entry_t *cur)
249249
thread_joiner_application_configuration_nvm_save(cur->id);
250250
mac_pairwise_key_flush_list(cur->id);
251251
thread_discovery_reset(cur->id);
252+
thread_leader_mleid_rloc_map_to_nvm_write(cur);
252253
thread_bootstrap_stop(cur);
253254
mle_service_interface_unregister(cur->id);
254255
thread_management_server_delete(cur->id);

source/6LoWPAN/Thread/thread_leader_service.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -742,11 +742,15 @@ void thread_leader_mleid_rloc_map_populate(thread_nvm_mleid_rloc_map *mleid_rloc
742742
}
743743
}
744744

745-
static int thread_leader_update_mleid_rloc_map_in_nvm(protocol_interface_info_entry_t *cur)
745+
int thread_leader_mleid_rloc_map_to_nvm_write(protocol_interface_info_entry_t *cur)
746746
{
747+
if (!cur->thread_info->leader_private_data) {
748+
return -1;
749+
}
750+
747751
thread_nvm_mleid_rloc_map *mleid_rloc_map = ns_dyn_mem_temporary_alloc(sizeof(thread_nvm_mleid_rloc_map));
748752
if (!mleid_rloc_map) {
749-
return -1;
753+
return -2;
750754
}
751755
memset(mleid_rloc_map, 0, sizeof(thread_nvm_mleid_rloc_map));
752756
thread_leader_mleid_rloc_map_populate(mleid_rloc_map, cur->thread_info->leader_private_data);
@@ -1533,7 +1537,7 @@ void thread_leader_service_timer(protocol_interface_info_entry_t *cur, uint32_t
15331537
}
15341538
else {
15351539
cur->thread_info->leader_private_data->leader_nvm_sync_timer = 0;
1536-
thread_leader_update_mleid_rloc_map_in_nvm(cur);
1540+
thread_leader_mleid_rloc_map_to_nvm_write(cur);
15371541
}
15381542
}
15391543

source/6LoWPAN/Thread/thread_leader_service.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ void thread_leader_service_network_data_changed(protocol_interface_info_entry_t
118118

119119
void thread_leader_service_timer(protocol_interface_info_entry_t *cur, uint32_t ticks);
120120

121+
int thread_leader_mleid_rloc_map_to_nvm_write(protocol_interface_info_entry_t *cur);
122+
121123
/** Get first child ID from network data based on parent ID
122124
*
123125
* \param thread_info
@@ -161,6 +163,8 @@ void thread_leader_service_router_state_changed(thread_info_t *thread_info, uint
161163

162164
#define thread_leader_service_router_state_changed(thread_info, router_id, available, interface_id)
163165

166+
#define thread_leader_mleid_rloc_map_to_nvm_write(cur) (0)
167+
164168
#endif /*HAVE_THREAD_LEADER_SERVICE*/
165169

166170
#endif /* _THREAD_LEADER_SERVICE_H_ */

test/nanostack/unittest/stub/thread_leader_service_stub.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,7 @@ void thread_leader_service_thread_partitition_generate(int8_t interface_id, bool
8383
void thread_leader_service_network_data_changed(protocol_interface_info_entry_t *cur, bool force_stable_update, bool force_unstable_update)
8484
{
8585
}
86+
int thread_leader_mleid_rloc_map_to_nvm_write(protocol_interface_info_entry_t *cur)
87+
{
88+
return 0;
89+
}

0 commit comments

Comments
 (0)