Skip to content

Commit c3c4cb9

Browse files
committed
fix: set TCP transport every time when setting the config
1 parent cac1552 commit c3c4cb9

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

include/mqtt_client.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ typedef struct esp_mqtt_client_config_t {
336336
int refresh_connection_after_ms; /*!< Refresh connection after this value (in milliseconds) */
337337
bool disable_auto_reconnect; /*!< Client will reconnect to server (when errors/disconnect). Set
338338
`disable_auto_reconnect=true` to disable */
339-
esp_transport_handle_t transport; /*!< Custom transport handle to use. Warning: The transport should be valid during the client lifetime and is destroyed when esp_mqtt_client_destroy is called. */
339+
esp_transport_handle_t transport; /*!< Custom transport handle to use, leave it NULL to allow MQTT client create or recreate its own. Warning: The transport should be valid during the client lifetime and is destroyed when esp_mqtt_client_destroy is called. */
340340
struct ifreq * if_name; /*!< The name of interface for data to go through. Use the default interface without setting */
341341
} network; /*!< Network configuration */
342342
/**

mqtt_client.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -526,9 +526,8 @@ esp_err_t esp_mqtt_set_config(esp_mqtt_client_handle_t client, const esp_mqtt_cl
526526
} else {
527527
client->config->reconnect_timeout_ms = MQTT_RECON_DEFAULT_MS;
528528
}
529-
if (config->network.transport) {
530-
client->config->transport = config->network.transport;
531-
}
529+
530+
client->config->transport = config->network.transport;
532531

533532
if (config->network.if_name) {
534533
client->config->if_name = calloc(1, sizeof(struct ifreq) + 1);

0 commit comments

Comments
 (0)