Skip to content

Commit

Permalink
Randomize fixed channel when making new parent selection
Browse files Browse the repository at this point in the history
  • Loading branch information
Mika Tervonen committed Feb 7, 2020
1 parent 34d0339 commit b9187da
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions source/6LoWPAN/ws/ws_bootstrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -2807,6 +2807,10 @@ void ws_bootstrap_network_scan_process(protocol_interface_info_entry_t *cur)
selected_parent_ptr = ws_bootstrap_candidate_parent_get_best(cur);

if (!selected_parent_ptr) {
// Configure LLC for network discovery
ws_bootstrap_network_discovery_configure(cur);
// randomize new channel and start MAC
ws_bootstrap_fhss_activate(cur);
// Next check will be after one trickle
cur->bootsrap_state_machine_cnt += cur->ws_info->trickle_params_pan_discovery.Imin + randLIB_get_8bit() % 50;
tr_info("Making parent selection in %u s", (cur->bootsrap_state_machine_cnt / 10));
Expand All @@ -2825,9 +2829,6 @@ void ws_bootstrap_network_scan_process(protocol_interface_info_entry_t *cur)
//Remove Neighbour and set Link setup back
ns_list_remove(&cur->ws_info->parent_list_reserved, selected_parent_ptr);
ns_list_add_to_end(&cur->ws_info->parent_list_free, selected_parent_ptr);
// Configure LLC for network discovery
ws_bootstrap_network_discovery_configure(cur);
ws_bootstrap_fhss_activate(cur);
goto select_best_candidate;
}

Expand Down

0 comments on commit b9187da

Please sign in to comment.