[Gst/MQTT/Sink] Fix the timeout to wait for disconnection
authorWook Song <wook16.song@samsung.com>
Wed, 2 Jun 2021 05:51:32 +0000 (14:51 +0900)
committerMyungJoo Ham <myungjoo.ham@samsung.com>
Mon, 7 Jun 2021 07:41:04 +0000 (16:41 +0900)
This patch corrects the timeout to wait for the disconnection to the
broker.

Signed-off-by: Wook Song <wook16.song@samsung.com>
gst/mqtt/mqttsink.c

index 4c724c2..e91e4e7 100644 (file)
@@ -63,7 +63,7 @@ enum
   DEFAULT_SYNC = FALSE,
   DEFAULT_MQTT_OPT_CLEANSESSION = TRUE,
   DEFAULT_MQTT_OPT_KEEP_ALIVE_INTERVAL = 60,    /* 1 minute */
-  DEFAULT_MQTT_DISCONNECT_TIMEOUT = 3000,       /* 3 secs */
+  DEFAULT_MQTT_DISCONNECT_TIMEOUT = G_TIME_SPAN_SECOND * 3,     /* 3 secs */
   DEFAULT_MQTT_PUB_WAIT_TIMEOUT = 1,    /* 1 secs */
   DEFAULT_MAX_MSG_BUF_SIZE = 0, /* Buffer size is not fixed */
   DEFAULT_MQTT_QOS = 0,         /* fire and forget */
@@ -553,8 +553,7 @@ gst_mqtt_sink_stop (GstBaseSink * basesink)
 
   g_atomic_int_set (&self->mqtt_sink_state, SINK_RENDER_STOPPED);
   while (MQTTAsync_isConnected (self->mqtt_client_handle)) {
-    gint64 end_time = g_get_monotonic_time () +
-        DEFAULT_MQTT_DISCONNECT_TIMEOUT / 10;
+    gint64 end_time = g_get_monotonic_time () + DEFAULT_MQTT_DISCONNECT_TIMEOUT;
     mqtt_sink_state_t cur_state;
 
     MQTTAsync_disconnect (self->mqtt_client_handle, &disconn_opts);