Skip to content

Commit b5b8033

Browse files
Merge branch 'fix/clean_transport' into 'master'
fix: set TCP transport every time when setting the config See merge request espressif/esp-mqtt!218
2 parents 1420c01 + c3c4cb9 commit b5b8033

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
@@ -341,7 +341,7 @@ typedef struct esp_mqtt_client_config_t {
341341
int refresh_connection_after_ms; /*!< Refresh connection after this value (in milliseconds) */
342342
bool disable_auto_reconnect; /*!< Client will reconnect to server (when errors/disconnect). Set
343343
`disable_auto_reconnect=true` to disable */
344-
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. */
344+
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. */
345345
struct ifreq * if_name; /*!< The name of interface for data to go through. Use the default interface without setting */
346346
} network; /*!< Network configuration */
347347
/**

mqtt_client.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -521,9 +521,8 @@ esp_err_t esp_mqtt_set_config(esp_mqtt_client_handle_t client, const esp_mqtt_cl
521521
} else {
522522
client->config->reconnect_timeout_ms = MQTT_RECON_DEFAULT_MS;
523523
}
524-
if (config->network.transport) {
525-
client->config->transport = config->network.transport;
526-
}
524+
525+
client->config->transport = config->network.transport;
527526

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

0 commit comments

Comments
 (0)