Skip to content

Commit

Permalink
updated mleid rloc sync in leader. (ARMmbed#1645)
Browse files Browse the repository at this point in the history
  • Loading branch information
deepakvenugopal authored Apr 9, 2018
1 parent 564d3fe commit 5af4a39
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
1 change: 1 addition & 0 deletions source/6LoWPAN/Thread/thread_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ int8_t thread_bootstrap_down(protocol_interface_info_entry_t *cur)
thread_joiner_application_configuration_nvm_save(cur->id);
mac_pairwise_key_flush_list(cur->id);
thread_discovery_reset(cur->id);
thread_leader_mleid_rloc_map_to_nvm_write(cur);
thread_bootstrap_stop(cur);
mle_service_interface_unregister(cur->id);
thread_management_server_delete(cur->id);
Expand Down
10 changes: 7 additions & 3 deletions source/6LoWPAN/Thread/thread_leader_service.c
Original file line number Diff line number Diff line change
Expand Up @@ -742,11 +742,15 @@ void thread_leader_mleid_rloc_map_populate(thread_nvm_mleid_rloc_map *mleid_rloc
}
}

static int thread_leader_update_mleid_rloc_map_in_nvm(protocol_interface_info_entry_t *cur)
int thread_leader_mleid_rloc_map_to_nvm_write(protocol_interface_info_entry_t *cur)
{
if (!cur->thread_info->leader_private_data) {
return -1;
}

thread_nvm_mleid_rloc_map *mleid_rloc_map = ns_dyn_mem_temporary_alloc(sizeof(thread_nvm_mleid_rloc_map));
if (!mleid_rloc_map) {
return -1;
return -2;
}
memset(mleid_rloc_map, 0, sizeof(thread_nvm_mleid_rloc_map));
thread_leader_mleid_rloc_map_populate(mleid_rloc_map, cur->thread_info->leader_private_data);
Expand Down Expand Up @@ -1533,7 +1537,7 @@ void thread_leader_service_timer(protocol_interface_info_entry_t *cur, uint32_t
}
else {
cur->thread_info->leader_private_data->leader_nvm_sync_timer = 0;
thread_leader_update_mleid_rloc_map_in_nvm(cur);
thread_leader_mleid_rloc_map_to_nvm_write(cur);
}
}

Expand Down
4 changes: 4 additions & 0 deletions source/6LoWPAN/Thread/thread_leader_service.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ void thread_leader_service_network_data_changed(protocol_interface_info_entry_t

void thread_leader_service_timer(protocol_interface_info_entry_t *cur, uint32_t ticks);

int thread_leader_mleid_rloc_map_to_nvm_write(protocol_interface_info_entry_t *cur);

/** Get first child ID from network data based on parent ID
*
* \param thread_info
Expand Down Expand Up @@ -161,6 +163,8 @@ void thread_leader_service_router_state_changed(thread_info_t *thread_info, uint

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

#define thread_leader_mleid_rloc_map_to_nvm_write(cur) (0)

#endif /*HAVE_THREAD_LEADER_SERVICE*/

#endif /* _THREAD_LEADER_SERVICE_H_ */
4 changes: 4 additions & 0 deletions test/nanostack/unittest/stub/thread_leader_service_stub.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,7 @@ void thread_leader_service_thread_partitition_generate(int8_t interface_id, bool
void thread_leader_service_network_data_changed(protocol_interface_info_entry_t *cur, bool force_stable_update, bool force_unstable_update)
{
}
int thread_leader_mleid_rloc_map_to_nvm_write(protocol_interface_info_entry_t *cur)
{
return 0;
}

0 comments on commit 5af4a39

Please sign in to comment.