esp-modem: Remove esp-netif destroy from modem network glue code

To be in line with other interfaces, when deleting the driver and it's glue layer to esp-netif, we DO NOT delete the related esp-netif (since is was allocated and created outside of the glue code and it works the same way in esp-eth and esp-wifi driver/glue layers).

Closes https://github.com/espressif/esp-idf/issues/5486
This commit is contained in:
David Cermak 2020-07-03 13:31:57 +02:00 committed by bot
parent 16e0ff273c
commit 6f1b8fe062
3 changed files with 6 additions and 3 deletions

View File

@ -109,7 +109,6 @@ drv_create_failed:
void esp_modem_netif_teardown(void *h)
{
esp_modem_netif_driver_t *driver = h;
esp_netif_destroy(driver->base.netif);
free(driver);
}

View File

@ -320,8 +320,10 @@ void app_main(void)
vTaskDelay(pdMS_TO_TICKS(60000));
}
/* Destroy the netif adapter withe events, which internally frees also the esp-netif instance */
/* Unregister events, destroy the netif adapter and destroy its esp-netif instance */
esp_modem_netif_clear_default_handlers(modem_netif_adapter);
esp_modem_netif_teardown(modem_netif_adapter);
esp_netif_destroy(esp_netif);
ESP_ERROR_CHECK(dte->deinit(dte));
}

View File

@ -258,9 +258,11 @@ void app_main(void)
ESP_ERROR_CHECK(esp_modem_stop_ppp(dte));
/* Wait for the PPP connection to terminate gracefully */
xEventGroupWaitBits(event_group, DISCONNECT_BIT, pdTRUE, pdTRUE, portMAX_DELAY);
/* Destroy the netif adapter withe events, which internally frees also the esp-netif instance */
/* Unregister events, destroy the netif adapter and destroy its esp-netif instance */
esp_modem_netif_clear_default_handlers(modem_netif_adapter);
esp_modem_netif_teardown(modem_netif_adapter);
esp_netif_destroy(esp_netif);
xEventGroupWaitBits(event_group, STOP_BIT, pdTRUE, pdTRUE, portMAX_DELAY);
ESP_ERROR_CHECK(dce->deinit(dce));
ESP_ERROR_CHECK(dte->deinit(dte));