@@ -980,16 +980,12 @@ static esp_err_t esp_mqtt_dispatch_event(esp_mqtt_client_handle_t client)
980
980
client -> event .protocol_ver = client -> connect_info .protocol_ver ;
981
981
esp_err_t ret = ESP_FAIL ;
982
982
983
- if (client -> config -> event_handle ) {
984
- ret = client -> config -> event_handle (& client -> event );
985
- } else {
986
983
#ifdef MQTT_SUPPORTED_FEATURE_EVENT_LOOP
987
984
esp_event_post_to (client -> config -> event_loop_handle , MQTT_EVENTS , client -> event .event_id , & client -> event , sizeof (client -> event ), portMAX_DELAY );
988
985
ret = esp_event_loop_run (client -> config -> event_loop_handle , 0 );
989
986
#else
990
987
return ESP_FAIL ;
991
988
#endif
992
- }
993
989
if (client -> connect_info .protocol_ver == MQTT_PROTOCOL_V_5 ) {
994
990
#ifdef MQTT_PROTOCOL_5
995
991
esp_mqtt5_client_delete_user_property (client -> event .property -> user_property );
@@ -2132,10 +2128,6 @@ esp_err_t esp_mqtt_client_register_event(esp_mqtt_client_handle_t client, esp_mq
2132
2128
return ESP_ERR_INVALID_ARG ;
2133
2129
}
2134
2130
#ifdef MQTT_SUPPORTED_FEATURE_EVENT_LOOP
2135
- if (client -> config -> event_handle ) {
2136
- ESP_LOGW (TAG , "Registering event loop while event callback is not null, clearing callback" );
2137
- client -> config -> event_handle = NULL ;
2138
- }
2139
2131
2140
2132
return esp_event_handler_register_with (client -> config -> event_loop_handle , MQTT_EVENTS , event , event_handler , event_handler_arg );
2141
2133
#else
@@ -2150,10 +2142,6 @@ esp_err_t esp_mqtt_client_unregister_event(esp_mqtt_client_handle_t client, esp_
2150
2142
return ESP_ERR_INVALID_ARG ;
2151
2143
}
2152
2144
#ifdef MQTT_SUPPORTED_FEATURE_EVENT_LOOP
2153
- if (client -> config -> event_handle ) {
2154
- ESP_LOGW (TAG , "Unregistering event loop while event callback is not null, clearing callback" );
2155
- client -> config -> event_handle = NULL ;
2156
- }
2157
2145
2158
2146
return esp_event_handler_unregister_with (client -> config -> event_loop_handle , MQTT_EVENTS , event , event_handler );
2159
2147
#else
0 commit comments