Skip to content

Commit

Permalink
Merge branch 'koli' into IOTTHD-2475
Browse files Browse the repository at this point in the history
* koli:
  Count the amount of configuration solicits
  • Loading branch information
Jarkko Paso committed May 4, 2018
2 parents c8f5c8d + 0ec37a6 commit c0e8cae
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
9 changes: 8 additions & 1 deletion source/6LoWPAN/ws/ws_bootstrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1102,6 +1102,7 @@ static void ws_bootstrap_start_configuration_learn(protocol_interface_info_entry
// Clear all temporary information
ws_bootstrap_ip_stack_reset(cur);

cur->ws_info->pas_requests = 0;
// Reset advertisement solicit trickle to start discovering network
trickle_start(&cur->ws_info->trickle_pan_config_solicit, &trickle_params_pan_discovery);
trickle_inconsistent_heard(&cur->ws_info->trickle_pan_config_solicit, &trickle_params_pan_discovery);
Expand Down Expand Up @@ -1334,7 +1335,6 @@ static void ws_bootstrap_event_handler(arm_event_s *event)
ws_bootstrap_ip_stack_activate(cur);
ws_bootstrap_rpl_activate(cur);
ws_bootstrap_network_start(cur);
ws_bootstrap_advertise_start(cur);
// Wait for RPL start
if (cur->bootsrap_mode == ARM_NWK_BOOTSRAP_MODE_6LoWPAN_BORDER_ROUTER) {
ws_bootstrap_event_routing_ready(cur);
Expand All @@ -1345,6 +1345,7 @@ static void ws_bootstrap_event_handler(arm_event_s *event)
break;
case WS_ROUTING_READY:
tr_info("Routing ready");
ws_bootstrap_advertise_start(cur);
ws_bootstrap_state_change(cur, ER_BOOTSRAP_DONE);
break;
case WS_ADDRESS_ADDED:
Expand Down Expand Up @@ -1483,7 +1484,13 @@ void ws_bootstrap_seconds_timer(protocol_interface_info_entry_t *cur, uint32_t s
}
if(trickle_timer(&cur->ws_info->trickle_pan_config_solicit, &trickle_params_pan_discovery, seconds)) {
// send PAN Configuration solicit
if (cur->ws_info->pas_requests > PCS_MAX) {
// if MAX PCS sent restart discovery
ws_bootstrap_event_discovery_start(cur);
return;
}
tr_info("Send PAN configuration Solicit");
cur->ws_info->pas_requests++;
ws_bootstrap_pan_config_solicit(cur);
}
if(trickle_timer(&cur->ws_info->trickle_pan_advertisement, &trickle_params_pan_discovery, seconds)) {
Expand Down
1 change: 1 addition & 0 deletions source/6LoWPAN/ws/ws_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ typedef struct ws_info_s {
trickle_t trickle_pan_advertisement_solicit;
trickle_t trickle_pan_advertisement;
uint8_t rpl_state; // state from rpl_event_t
uint8_t pas_requests; // Amount of PAN solicits sent
parent_info_t parent_info;
uint32_t pan_version_timer; /**< border router version udate timeout */
uint32_t pan_version_timeout_timer; /**< routers will fallback to previous state after this */
Expand Down
7 changes: 6 additions & 1 deletion source/6LoWPAN/ws/ws_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,9 @@ extern int8_t DEVICE_MIN_SENS;
/* Candidate parent Threshold hysteresis
*/
#define CAND_PARENT_HYSTERISIS 3
#endif /* WS_CONFIG_H_ */

/* Maximum amount of Pan Configuration Solicits before restarting Discovery.
*/
#define PCS_MAX 5

#endif /* WS_CONFIG_H_ */

0 comments on commit c0e8cae

Please sign in to comment.