[Live-devel] Properly shutting down stream after TEARDOWN

Ross Finlayson finlayson at live555.com
Wed Oct 10 20:44:59 PDT 2012


> Lately I've seen some random exceptions when streams are being shut down. I believe these were introduced when I changed the code so it waits for a TEARDOWN response. This was btw done as Cisco mentioned their server requires that.
> 
BTW, that doesn't really make much sense, because after the server receives a "TEARDOWN" request, it has no further communication from that client - other than the client closing the connection.  But the server needs to be prepared for the client closing the connection at any time anyway.  So the server really shouldn't care whether or not the client waits for a response to the "TEARDOWN".  But anyway:

> I'm probably doing something wrong, as it appears the error happens in, or are related to, the TEARDOWN response handler.
> 
> With the shutdownStream() function in testRTSPClient as a model I basically added a response handler to the sendTeardownCommand() and added an additional cleanup function that should take care of the final cleanup and properly close the rtspClient.
> 
> - Can't I assume the rtspClient is valid after TEARDOWN?
> 
Yes, the "RTSPClient" object remains valid until you call "Medium::close()" on it.  So therefore, make sure that you don't call "Medium::close()" until *after* you've received the response to the "TEARDOWN".  (Note that the "testRTSPClient" code calls "Medium::close()" on "rtspClient" immediately after sending the "TEARDOWN" command, so obviously you'll need to change that in your code.)

Ross Finlayson
Live Networks, Inc.
http://www.live555.com/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20121010/34a01d06/attachment.html>


More information about the live-devel mailing list