From 3671647cd579a52418abed277eec2d4fa39a5d91 Mon Sep 17 00:00:00 2001 From: MysticBoy Date: Wed, 27 May 2020 00:47:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E6=94=BE=E5=88=B0?= =?UTF-8?q?=E5=90=AF=E5=8A=A8=E9=83=A8=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/plugins/mqtt/src/mqttSystem.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/plugins/mqtt/src/mqttSystem.c b/src/plugins/mqtt/src/mqttSystem.c index 030d950a79..33d83228a7 100644 --- a/src/plugins/mqtt/src/mqttSystem.c +++ b/src/plugins/mqtt/src/mqttSystem.c @@ -38,6 +38,12 @@ char* topicPath; int isStop = 1; int32_t mqttInitSystem() { int rc = 0; + + return rc; +} + +int32_t mqttStartSystem() { + int rc = 0; uint8_t sendbuf[2048]; uint8_t recvbuf[1024]; recnt_status.sendbuf = sendbuf; @@ -54,7 +60,7 @@ int32_t mqttInitSystem() { recnt_status.hostname = strbetween(url, "//", ":"); } else { - recnt_status.hostname = strbetween(url, "//", "/"); + recnt_status.hostname = strbetween(url, "//", "/"); } char* _begin_hostname = strstr(url, recnt_status.hostname); @@ -65,22 +71,16 @@ int32_t mqttInitSystem() { } topicPath = strbetween(strstr(url, strstr(_begin_hostname, ":") != NULL ? recnt_status.port : recnt_status.hostname), - "/", "/"); + "/", "/"); char* _topic = "+/+/+/"; int _tpsize = strlen(topicPath) + strlen(_topic) + 1; recnt_status.topic = calloc(1, _tpsize); sprintf(recnt_status.topic, "/%s/%s", topicPath, _topic); - recnt_status.client_id = strlen(tsMqttBrokerClientId)<3? tsMqttBrokerClientId:"taos_mqtt"; - + recnt_status.client_id = strlen(tsMqttBrokerClientId) < 3 ? tsMqttBrokerClientId : "taos_mqtt"; taos_init(); mqttPrint("mqttInitSystem mqtt://%s:%s@%s:%s/%s/", recnt_status.user_name, recnt_status.password, recnt_status.hostname, recnt_status.port, topicPath); - return rc; -} - -int32_t mqttStartSystem() { - int rc = 0; mqtt_conn = NULL; mqtt_init_reconnect(&client, mqttReconnectClient, &recnt_status, mqtt_PublishCallback); if (pthread_create(&client_daemon, NULL, mqttClientRefresher, &client)) { -- GitLab