[Live-devel] Event Loop Not Terminating

Gord Umphrey gordu at dvr2010.com
Wed May 7 17:58:30 PDT 2014


Hi Ross;

We use the event loop ‘watch variable’ mechanism to stop the event loop and terminate our application (which is based on the testRTSPClient sample).  This works about 99.9% of the time.  However our systems run 24/7 and occasionally we are finding that the event loop does not terminate.  After some painful investigation we figured out why.  The problem is in RTPInterface.cpp, member function sendDataOverTCP().  The event loop is hung in the socket send function – because the socket is in blocking mode.

We have modified the live555 source as follows.  Instead of making the socket blocking we have set a send timeout with:

int milliseconds = 1000;
setsockopt(socket, SOL_SOCKET, SO_SNDTIMEO, (char *)&milliseconds, sizeof(int));

This prevents the hanging and allows the event loop to exit.

Another option would be to close the socket handle from a different thread which would cause the socket send function to return.  (This is how we break out of a blocking socket call in other environments).  However there does not seem to be a way to get the socket handle since these variables are private, as is RTSPClient::resetTCPSockets.

We would prefer not to modify live555 source, so if you have any suggestions we would greatly appreciate it.

Thank you,
Gord.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20140507/df75ac82/attachment.html>


More information about the live-devel mailing list