Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(nan_console): Error when NAN Discovery is started more than once (IDFGH-13923) #14762

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion examples/wifi/wifi_aware/nan_console/main/nan_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ static struct {
} ping_args;

static const char *TAG = "nan_console";
static esp_netif_t *g_nan_netif;
static esp_netif_t *g_nan_netif = NULL;
entrop1a marked this conversation as resolved.
Show resolved Hide resolved

#define NAN_EXAMPLE_SERVICE_NAME "ESP_NAN-Service"

Expand Down Expand Up @@ -235,6 +235,11 @@ static int wifi_cmd_nan_disc(int argc, char **argv)
nan_cfg.warm_up_sec = nan_args.warmup_time->ival[0];
}

if(!g_nan_netif)
{
g_nan_netif = esp_netif_create_default_wifi_nan();
}

g_nan_netif = esp_netif_create_default_wifi_nan();
entrop1a marked this conversation as resolved.
Show resolved Hide resolved
if ((esp_wifi_nan_start(&nan_cfg)) != ESP_OK) {
ESP_LOGI(TAG, "Failed to start NAN");
Expand All @@ -252,6 +257,7 @@ static int wifi_cmd_nan_disc(int argc, char **argv)
return 1;
}
esp_netif_destroy_default_wifi(g_nan_netif);
g_nan_netif = NULL;
}

return 0;
Expand Down