Skip to content

Commit

Permalink
Removes redundant field on mqtt state
Browse files Browse the repository at this point in the history
Client connection_info was unnecessarilly repeated. Removed from
mqtt_state and kept on mqtt_client.
  • Loading branch information
euripedesrocha authored and david-cermak committed Nov 1, 2021
1 parent 1fd50dd commit 09287a1
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions mqtt_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ ESP_EVENT_DEFINE_BASE(MQTT_EVENTS);
#endif

typedef struct mqtt_state {
mqtt_connect_info_t *connect_info;
uint8_t *in_buffer;
uint8_t *out_buffer;
int in_buffer_length;
Expand Down Expand Up @@ -372,7 +371,7 @@ esp_err_t esp_mqtt_set_config(esp_mqtt_client_handle_t client, const esp_mqtt_cl

client->config->message_retransmit_timeout = config->message_retransmit_timeout;
if (config->message_retransmit_timeout <= 0) {
client->config->message_retransmit_timeout = 1000;
client->config->message_retransmit_timeout = 1000;
}

client->config->task_prio = config->task_prio;
Expand Down Expand Up @@ -628,7 +627,7 @@ static esp_err_t esp_mqtt_connect(esp_mqtt_client_handle_t client, int timeout_m
int read_len, connect_rsp_code;
client->wait_for_ping_resp = false;
client->mqtt_state.outbound_message = mqtt_msg_connect(&client->mqtt_state.mqtt_connection,
client->mqtt_state.connect_info);
&client->connect_info);
if (client->mqtt_state.outbound_message->length == 0) {
ESP_LOGE(TAG, "Connect message cannot be created");
return ESP_FAIL;
Expand Down Expand Up @@ -796,7 +795,6 @@ esp_mqtt_client_handle_t esp_mqtt_client_init(const esp_mqtt_client_config_t *co
ESP_MEM_CHECK(TAG, client->mqtt_state.out_buffer, goto _mqtt_init_failed);

client->mqtt_state.out_buffer_length = out_buffer_size;
client->mqtt_state.connect_info = &client->connect_info;
client->outbox = outbox_init();
ESP_MEM_CHECK(TAG, client->outbox, goto _mqtt_init_failed);
client->status_bits = xEventGroupCreate();
Expand Down

0 comments on commit 09287a1

Please sign in to comment.