mirror of
https://github.com/espressif/esp-mqtt.git
synced 2025-07-29 18:28:24 +02:00
Merge branch 'bugfix/network_timeout' into 'master'
Allow to configure network timeout See merge request espressif/esp-mqtt!78
This commit is contained in:
@ -179,7 +179,7 @@ typedef struct {
|
||||
int refresh_connection_after_ms; /*!< Refresh connection after this value (in milliseconds) */
|
||||
const struct psk_key_hint* psk_hint_key; /*!< Pointer to PSK struct defined in esp_tls.h to enable PSK authentication (as alternative to certificate verification). If not NULL and server/client certificates are NULL, PSK is enabled */
|
||||
bool use_global_ca_store; /*!< Use a global ca_store for all the connections in which this bool is set. */
|
||||
int reconnect_timeout_ms; /*!< Reconnect to the broker after this value in miliseconds if auto reconnect is not disabled */
|
||||
int reconnect_timeout_ms; /*!< Reconnect to the broker after this value in miliseconds if auto reconnect is not disabled (defaults to 10s) */
|
||||
const char **alpn_protos; /*!< NULL-terminated list of supported application protocols to be used for ALPN */
|
||||
const char *clientkey_password; /*!< Client key decryption password string */
|
||||
int clientkey_password_len; /*!< String length of the password pointed to by clientkey_password */
|
||||
@ -188,6 +188,7 @@ typedef struct {
|
||||
bool skip_cert_common_name_check; /*!< Skip any validation of server certificate CN field, this reduces the security of TLS and makes the mqtt client susceptible to MITM attacks */
|
||||
bool use_secure_element; /*!< enable secure element for enabling SSL connection */
|
||||
void *ds_data; /*!< carrier of handle for digital signature parameters */
|
||||
int network_timeout_ms; /*!< Abort network operation if it is not completed after this value, in milliseconds (defaults to 10s) */
|
||||
} esp_mqtt_client_config_t;
|
||||
|
||||
/**
|
||||
|
@ -431,7 +431,11 @@ esp_err_t esp_mqtt_set_config(esp_mqtt_client_handle_t client, const esp_mqtt_cl
|
||||
#endif
|
||||
}
|
||||
|
||||
cfg->network_timeout_ms = MQTT_NETWORK_TIMEOUT_MS;
|
||||
cfg->network_timeout_ms = config->network_timeout_ms;
|
||||
if (cfg->network_timeout_ms <= 0) {
|
||||
cfg->network_timeout_ms = MQTT_NETWORK_TIMEOUT_MS;
|
||||
}
|
||||
|
||||
if (config->user_context) {
|
||||
cfg->user_context = config->user_context;
|
||||
}
|
||||
|
Reference in New Issue
Block a user