-
Notifications
You must be signed in to change notification settings - Fork 169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[MQTT] Wait until connection is established. #3518
Conversation
📝 TAOS-CI Version: 1.5.20200925. Thank you for submitting PR #3518. Please a submit 1commit/1PR (one commit per one PR) policy to get comments quickly from reviewers. Your PR must pass all verificiation processes of cibot before starting a review process from reviewers. If you are new member to join this project, please read manuals in documentation folder and wiki page. In order to monitor a progress status of your PR in more detail, visit http://nnstreamer.mooo.com/. |
eb5ce9c
to
d5d8e97
Compare
gst/mqtt/mqttsink.c
Outdated
@@ -551,6 +552,8 @@ gst_mqtt_sink_start (GstBaseSink * basesink) | |||
gchar *haddr = g_strdup_printf ("%s:%s", self->mqtt_host_address, | |||
self->mqtt_host_port); | |||
int ret; | |||
guint timer = 0; | |||
guint tick = DEFAULT_MQTT_SLEEP_TIME_US / 1000U; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my opinion, tick
would be DEFAULT_MQTT_SLEEP_TIME_US
.
If tick is 1U (i.e.DEFAULT_MQTT_SLEEP_TIME_US / 1000U) , while loop could run 5000 times in case of worst case. If your intent, then it's OK.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. I changed g_cond_wait_until
instead of sleep
. Please check it again.
cibot: @gichan-jang, A builder checker could not be completed because one of the checkers is not completed. In order to find out a reason, please go to http://nnstreamer.mooo.com/nnstreamer/ci/repo-workers/pr-checker/3518-202110121016160.95147395133972-d5d8e971f8e546955f3a893bf640896bb80d7791/. |
@@ -586,6 +589,16 @@ gst_mqtt_sink_start (GstBaseSink * basesink) | |||
return FALSE; | |||
} | |||
|
|||
/* Waiting for the connection */ | |||
while (!self->is_connected) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Q: not communicating with cond
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I updated it. Please check it again.
d5d8e97
to
8cb6923
Compare
The mqtt test was modified because the harness could not go to the playing state with the wrong parameter. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gichan-jang, 💯 All CI checkers are successfully verified. Thanks.
8cb6923
to
9897f41
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gichan-jang, 💯 All CI checkers are successfully verified. Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM ✔
Questions.. |
Change to wait until connection is successfully established within timeout limit. This patch fix the error: ERROR: MQTTSrc: cb_mqtt_on_connect_failure: failed to connect to the broker: TCP/TLS connect failure. Test pipeline: Publisher ```bash $ gst-launch-1.0 videotestsrc is-live=true ! video/x-raw,format=RGB,width=640,height=480,framerate=5/1 ! mqttsink pub-topic=test/videotestsrc ``` Subscriber ```bash $ gst-launch-1.0 mqttsrc sub-topic=test/videotestsrc ! video/x-raw,format=RGB,width=640,height=480,framerate=5/1 ! videoconvert ! ximagesink ``` Signed-off-by: gichan <gichan2.jang@samsung.com> Signed-off-by: Gichan Jang <gichan2.jang@samsung.com>
9897f41
to
415ca06
Compare
If subscriber fails to connect to the broker within the TIMEOUT, it cannot change to playing state and stopped.
Same with subscribers.
Answered. Q4: do you expect (novice) users will be able to "know" what's wrong when this TIMEOUT expires? I add some guide with error message. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gichan-jang, 💯 All CI checkers are successfully verified. Thanks.
It's ok with subscribers to fail with timeout when publishers do not exist. However, I still don't understand why publishers need to fail with no subscribers. We may proceed with this PR, but, publishers (and query servers) definitely need to be able to keep running (either 'paused' or 'dropping at sink') even if there are no subscribers (or query clients) with next PRs. Imagine you are a server pipeline author and want to start an object detection service for arbitrary IoT devices in TV, Home Hub, or Phone. You don't want to launch pipelines when there is a IoT device connecting for the service; you want to keep running pipelines (server process) and let pipeline wait for incoming IoT devices. |
No.. Even without a subscriber, the publisher does not fail. |
Change to wait until the connection is successfully finished within the timeout limit.
This patch fixes the error:
ERROR: MQTTSrc: cb_mqtt_on_connect_failure: failed to connect to the broker: TCP/TLS connect failure.
Test pipeline:
Publisher
Subscriber
Signed-off-by: gichan gichan2.jang@samsung.com
Self evaluation: