@@ -5148,8 +5148,6 @@ static void _mdns_free_action(mdns_action_t *action)
5148
5148
*/
5149
5149
static void _mdns_execute_action (mdns_action_t * action )
5150
5150
{
5151
- mdns_srv_item_t * a = NULL ;
5152
-
5153
5151
switch (action -> type ) {
5154
5152
case ACTION_SYSTEM_EVENT :
5155
5153
perform_event_action (action -> data .sys_event .interface , action -> data .sys_event .event_action );
@@ -5169,19 +5167,6 @@ static void _mdns_execute_action(mdns_action_t *action)
5169
5167
_mdns_server -> instance = action -> data .instance ;
5170
5168
_mdns_restart_all_pcbs_no_instance ();
5171
5169
5172
- break ;
5173
- case ACTION_SERVICES_CLEAR :
5174
- _mdns_send_final_bye (false);
5175
- a = _mdns_server -> services ;
5176
- _mdns_server -> services = NULL ;
5177
- while (a ) {
5178
- mdns_srv_item_t * s = a ;
5179
- a = a -> next ;
5180
- _mdns_remove_scheduled_service_packets (s -> service );
5181
- _mdns_free_service (s -> service );
5182
- free (s );
5183
- }
5184
-
5185
5170
break ;
5186
5171
case ACTION_SEARCH_ADD :
5187
5172
_mdns_search_add (action -> data .search_add .search );
@@ -6453,27 +6438,27 @@ esp_err_t mdns_service_remove(const char *service_type, const char *proto)
6453
6438
6454
6439
esp_err_t mdns_service_remove_all (void )
6455
6440
{
6456
- if (!_mdns_server ) {
6457
- return ESP_ERR_INVALID_ARG ;
6458
- }
6459
6441
MDNS_SERVICE_LOCK ();
6442
+ esp_err_t ret = ESP_OK ;
6443
+ ESP_GOTO_ON_FALSE (_mdns_server , ESP_ERR_INVALID_ARG , done , TAG , "Invalid state" );
6460
6444
if (!_mdns_server -> services ) {
6461
- MDNS_SERVICE_UNLOCK ();
6462
- return ESP_OK ;
6445
+ goto done ;
6463
6446
}
6464
- MDNS_SERVICE_UNLOCK ();
6465
6447
6466
- mdns_action_t * action = ( mdns_action_t * ) malloc ( sizeof ( mdns_action_t ) );
6467
- if (! action ) {
6468
- HOOK_MALLOC_FAILED ;
6469
- return ESP_ERR_NO_MEM ;
6470
- }
6471
- action -> type = ACTION_SERVICES_CLEAR ;
6472
- if ( xQueueSend ( _mdns_server -> action_queue , & action , ( TickType_t ) 0 ) != pdPASS ) {
6473
- free ( action );
6474
- return ESP_ERR_NO_MEM ;
6448
+ _mdns_send_final_bye (false );
6449
+ mdns_srv_item_t * services = _mdns_server -> services ;
6450
+ _mdns_server -> services = NULL ;
6451
+ while ( services ) {
6452
+ mdns_srv_item_t * s = services ;
6453
+ services = services -> next ;
6454
+ _mdns_remove_scheduled_service_packets ( s -> service );
6455
+ _mdns_free_service ( s -> service );
6456
+ free ( s ) ;
6475
6457
}
6476
- return ESP_OK ;
6458
+
6459
+ done :
6460
+ MDNS_SERVICE_UNLOCK ();
6461
+ return ret ;
6477
6462
}
6478
6463
6479
6464
/*
0 commit comments