aes67-linux-daemon icon indicating copy to clipboard operation
aes67-linux-daemon copied to clipboard

aes67-daemon hangs on inaccessible rtsp url for sdp

Open glance- opened this issue 3 years ago • 3 comments

I tried to add a local sink with the SPD source: "rtsp://test/api/source/sdp/2"

This seem to have gotten the aes67 daemon to get stuck waiting for it.

It took about 4 minutes before it timed out that socket connection and the daemon started answering to http requests again.

A quick test like:

--- rtsp_client.cpp
+++ rtsp_client.cpp
@@ -133,6 +133,7 @@
   try {
     BOOST_LOG_TRIVIAL(debug) << "rtsp_client:: connecting to "
                              << "rtsp://" << address << ":" << port << path;
+    s.expires_after(std::chrono::seconds(5));
     s.connect(address, port.length() ? port : dft_port);
     if (!s || s.error()) {
       BOOST_LOG_TRIVIAL(warning)

Solves that specific issue but i'm guessing it breaks the wait_for_updates functionality, and possibly other things to.

What is the suggested way of solving this in a better way?

glance- avatar Aug 09 '22 11:08 glance-

I think your solution is good and also a timeout in the range of 5 to 10 seconds looks reasonable considering the RTSP server is on the same LAN. In the end it will be handled as if we cannot connect. The only thing is that expires_after exists only starting from BOOST_VERSION >= 106600 A solution could be:

#if BOOST_VERSION < 106600
  s.expires_from_now(boost::posix_time::seconds(5));
#else
  s.expires_after(boost::asio::chrono::seconds(5));
#endif

bondagit avatar Aug 09 '22 13:08 bondagit

if this works for you I can proceed with the merge into master. Please let me know.

bondagit avatar Aug 10 '22 13:08 bondagit

Works just fine for me. All ok for me to write up and commit.

glance- avatar Aug 11 '22 09:08 glance-