Jelajahi Sumber

关闭mqtt重连

liuxiulin 4 bulan lalu
induk
melakukan
97576f4b1b
1 mengubah file dengan 2 tambahan dan 2 penghapusan
  1. 2 2
      services/emqx-agent/client/mqtt_client.go

+ 2 - 2
services/emqx-agent/client/mqtt_client.go

@@ -56,8 +56,8 @@ func initMqttClient(conf *MqttConfig) (mc MQTT.Client, err error) {
 		opts.AddBroker(broker)
 		opts.AddBroker(broker)
 	}
 	}
 	opts.SetClientID(fmt.Sprintf("%s_%s", conf.ClientId, guid.S())).
 	opts.SetClientID(fmt.Sprintf("%s_%s", conf.ClientId, guid.S())).
-		SetUsername(conf.User).SetPassword(conf.Password).
-		SetConnectRetry(true)
+		SetUsername(conf.User).SetPassword(conf.Password)
+	//SetConnectRetry(true)
 	opts.SetConnectionAttemptHandler(func(broker *url.URL, tlsCfg *tls.Config) *tls.Config {
 	opts.SetConnectionAttemptHandler(func(broker *url.URL, tlsCfg *tls.Config) *tls.Config {
 		server.Log.Infof("connect to %s", broker.String())
 		server.Log.Infof("connect to %s", broker.String())
 		return tlsCfg
 		return tlsCfg