mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-10 07:44:50 +01:00
76 lines
2.1 KiB
Diff
76 lines
2.1 KiB
Diff
diff --git a/src/core/device_mqtt.c b/src/core/device_mqtt.c
|
|
index 7438e59..231d941 100755
|
|
--- a/src/core/device_mqtt.c
|
|
+++ b/src/core/device_mqtt.c
|
|
@@ -1612,14 +1612,23 @@ int NotifyChange_MQTTRequestProblemInfo(dm_req_t *req, char *value)
|
|
int NotifyChange_MQTTConnectRetryTime(dm_req_t *req, char *value)
|
|
{
|
|
mqtt_conn_params_t *mp;
|
|
+ bool schedule_reconnect = false;
|
|
|
|
// Determine mqtt client to be updated
|
|
mp = FindMqttParamsByInstance(inst1);
|
|
USP_ASSERT(mp != NULL);
|
|
|
|
// Set the new value.
|
|
+ if ((mp->retry.connect_retrytime != val_uint) && (mp->enable)) {
|
|
+ schedule_reconnect = true;
|
|
+ }
|
|
+
|
|
mp->retry.connect_retrytime = val_uint;
|
|
|
|
+ if (schedule_reconnect) {
|
|
+ ScheduleMqttReconnect(mp);
|
|
+ }
|
|
+
|
|
return USP_ERR_OK;
|
|
}
|
|
|
|
@@ -1638,14 +1647,23 @@ int NotifyChange_MQTTConnectRetryTime(dm_req_t *req, char *value)
|
|
int NotifyChange_MQTTConnectRetryIntervalMultiplier(dm_req_t *req, char *value)
|
|
{
|
|
mqtt_conn_params_t *mp;
|
|
+ bool schedule_reconnect = false;
|
|
|
|
// Determine mqtt client to be updated
|
|
mp = FindMqttParamsByInstance(inst1);
|
|
USP_ASSERT(mp != NULL);
|
|
|
|
+ if ((mp->retry.interval_multiplier != val_int) && (mp->enable)) {
|
|
+ schedule_reconnect = true;
|
|
+ }
|
|
+
|
|
// Set the new value.
|
|
mp->retry.interval_multiplier = val_int;
|
|
|
|
+ if (schedule_reconnect) {
|
|
+ ScheduleMqttReconnect(mp);
|
|
+ }
|
|
+
|
|
return USP_ERR_OK;
|
|
}
|
|
|
|
@@ -1664,14 +1682,23 @@ int NotifyChange_MQTTConnectRetryIntervalMultiplier(dm_req_t *req, char *value)
|
|
int NotifyChange_MQTTConnectRetryMaxInterval(dm_req_t *req, char *value)
|
|
{
|
|
mqtt_conn_params_t *mp;
|
|
+ bool schedule_reconnect = false;
|
|
|
|
// Determine mqtt client to be updated
|
|
mp = FindMqttParamsByInstance(inst1);
|
|
USP_ASSERT(mp != NULL);
|
|
|
|
+ if ((mp->retry.max_interval != val_uint) && (mp->enable)) {
|
|
+ schedule_reconnect = true;
|
|
+ }
|
|
+
|
|
// Set the new value.
|
|
mp->retry.max_interval = val_uint;
|
|
|
|
+ if (schedule_reconnect) {
|
|
+ ScheduleMqttReconnect(mp);
|
|
+ }
|
|
+
|
|
return USP_ERR_OK;
|
|
}
|
|
|