Skip to content

Commit d2ddb1a

Browse files
author
Arto Kinnunen
authored
Send new a/sd immediately after address change (#1576)
When new address is assigned to Thread BR it will: - cancel previous a/sd and a/as messages - send a/sd (Server Data Notification) immediately
1 parent c18d1fd commit d2ddb1a

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

source/6LoWPAN/Thread/thread_bootstrap.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1010,7 +1010,13 @@ void thread_tasklet(arm_event_s *event)
10101010
thread_bootstrap_child_id_request(cur);
10111011
if (thread_nd_own_service_list_data_size(&cur->thread_info->localServerDataBase)) {
10121012
// publish our services to allow leader to remove old ones
1013-
thread_border_router_publish(cur->id);
1013+
if (!cur->thread_info->localServerDataBase.publish_active) {
1014+
/*
1015+
* publish only when publish is not active, otherwise let resubmit timer check
1016+
* handle publish after short time period.
1017+
*/
1018+
thread_border_router_publish(cur->id);
1019+
}
10141020
}
10151021
thread_router_bootstrap_address_change_notify_send(cur);
10161022
// Validate network data after a short period

source/6LoWPAN/Thread/thread_border_router_api.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -884,9 +884,16 @@ int thread_border_router_publish(int8_t interface_id)
884884
tr_debug("Border router old: %x, new: %x", cur->thread_info->localServerDataBase.registered_rloc16, rloc16);
885885

886886
if (cur->thread_info->localServerDataBase.publish_active) {
887-
cur->thread_info->localServerDataBase.publish_pending = true;
888-
tr_debug("Activate pending status for publish");
889-
return 0;
887+
if (rloc16 != cur->thread_info->localServerDataBase.registered_rloc16) {
888+
/*
889+
* Device short address has changed, cancel previous a/sd and a/as requests
890+
* */
891+
thread_management_client_pending_coap_request_kill(cur->id);
892+
} else {
893+
cur->thread_info->localServerDataBase.publish_pending = true;
894+
tr_debug("Activate pending status for publish");
895+
return 0;
896+
}
890897
}
891898

892899
//Allocate Memory for Data

0 commit comments

Comments
 (0)