From: Jaeyun Jung Date: Mon, 5 Feb 2024 09:43:06 +0000 (+0900) Subject: [MQTT] clearly set null when closing connection X-Git-Tag: accepted/tizen/unified/20240319.020738~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0085b9d4f481224bd7d0129babcdcb27a5ed10eb;p=platform%2Fupstream%2Fnnstreamer-edge.git [MQTT] clearly set null when closing connection Clearly set connection state and handle when closing MQTT connection. Signed-off-by: Jaeyun Jung --- diff --git a/src/libnnstreamer-edge/nnstreamer-edge-mqtt-mosquitto.c b/src/libnnstreamer-edge/nnstreamer-edge-mqtt-mosquitto.c index b06095f..2b8adce 100644 --- a/src/libnnstreamer-edge/nnstreamer-edge-mqtt-mosquitto.c +++ b/src/libnnstreamer-edge/nnstreamer-edge-mqtt-mosquitto.c @@ -214,7 +214,7 @@ nns_edge_mqtt_connect (const char *id, const char *topic, const char *host, } if (!broker_h) { - nns_edge_loge ("Invalid param, mqtt_h should not be null."); + nns_edge_loge ("Invalid param, broker_h should not be null."); return NNS_EDGE_ERROR_INVALID_PARAMETER; } @@ -304,6 +304,9 @@ nns_edge_mqtt_close (nns_edge_broker_h broker_h) mosquitto_lib_cleanup (); } + bh->mqtt_h = NULL; + bh->connected = false; + nns_edge_queue_destroy (bh->message_queue); bh->message_queue = NULL; nns_edge_lock_destroy (bh); diff --git a/src/libnnstreamer-edge/nnstreamer-edge-mqtt-paho.c b/src/libnnstreamer-edge/nnstreamer-edge-mqtt-paho.c index fd1a5f5..7216885 100644 --- a/src/libnnstreamer-edge/nnstreamer-edge-mqtt-paho.c +++ b/src/libnnstreamer-edge/nnstreamer-edge-mqtt-paho.c @@ -138,7 +138,7 @@ nns_edge_mqtt_connect (const char *id, const char *topic, const char *host, } if (!broker_h) { - nns_edge_loge ("Invalid param, mqtt_h should not be null."); + nns_edge_loge ("Invalid param, broker_h should not be null."); return NNS_EDGE_ERROR_INVALID_PARAMETER; } @@ -258,6 +258,8 @@ nns_edge_mqtt_close (nns_edge_broker_h broker_h) MQTTAsync_destroy (&handle); } + bh->mqtt_h = NULL; + nns_edge_queue_destroy (bh->message_queue); bh->message_queue = NULL;