Skip to content

Commit 822567b

Browse files
author
Seppo Takalo
committed
Initialize mac_api only once.
1 parent f91d8eb commit 822567b

File tree

1 file changed

+5
-2
lines changed
  • features/net/FEATURE_NANOSTACK/mbed-mesh-api/source

1 file changed

+5
-2
lines changed

features/net/FEATURE_NANOSTACK/mbed-mesh-api/source/nd_tasklet.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ typedef struct {
7272

7373
/* Tasklet data */
7474
static tasklet_data_str_t *tasklet_data_ptr = NULL;
75+
static mac_api_t *mac_api = NULL;
7576

7677
/* private function prototypes */
7778
void nd_tasklet_main(arm_event_s *event);
@@ -427,7 +428,9 @@ int8_t nd_tasklet_network_init(int8_t device_id)
427428
storage_sizes.key_description_table_size = 3;
428429
storage_sizes.key_lookup_size = 1;
429430
storage_sizes.key_usage_size = 3;
430-
mac_api_t *api = ns_sw_mac_create(device_id, &storage_sizes);
431-
return arm_nwk_interface_lowpan_init(api, INTERFACE_NAME);
431+
if (!mac_api) {
432+
mac_api = ns_sw_mac_create(device_id, &storage_sizes);
433+
}
434+
return arm_nwk_interface_lowpan_init(mac_api, INTERFACE_NAME);
432435
}
433436

0 commit comments

Comments
 (0)