<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.5726" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>
<DIV><FONT face=Arial size=2>H<FONT face="Times New Roman" size=3>i
</FONT>Ross.</FONT></DIV>
<DIV> </DIV>
<DIV> I sent this e-mail on jenuary the 7th in an existing
thread. I apologize for my fault. Here it is same question.</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2> In the past you sayd (let me not
search that mail!) that by now there is not a way to release live clientsessions
when the RTSPServer is being deleted.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2> I solved this issue with some
code and I'd like to know your opinion about my solution.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2> I
defined fRTSPClientSessions in RTSPServer the same way it has
fServerMediaSessions.</FONT></DIV><FONT face=Arial size=2>
<DIV><FONT face=Arial size=2> So in the RTSPServer constructor
we find:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>
<DIV>[code]</DIV>
fServerMediaSessions(HashTable::create(STRING_HASH_KEYS)), <BR>#if
(USE_CLIENT_SESSION_MANAGEMENT)<BR>
fRTSPClientSessions(HashTable::create(STRING_HASH_KEYS)),<BR>#endif //
USE_CLIENT_SESSION_MANAGEMENT<BR></FONT></DIV>
<DIV><FONT face=Arial size=2>
<DIV>[/code]</DIV>
<DIV> </DIV></FONT></DIV>
<DIV><FONT face=Arial size=2>and in the RTSPServer destructor we
find</FONT></DIV>
<DIV> </DIV>
<DIV>[code]</DIV>
<DIV> <BR>
::closeSocket(fServerSocket);</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>#if (USE_CLIENT_SESSION_MANAGEMENT)<BR> //
rimozione di eventuali client ancora presenti // deletion of live clients, if
any<BR> while (1) {<BR> RTSPClientSession*
rtspClientSession<BR> =
(RTSPClientSession*)fRTSPClientSessions->RemoveNext();<BR>
if (rtspClientSession == NULL) break;<BR> try { delete
rtspClientSession ; }catch(...)<BR> {
<BR> int a = 10 ; // for debug
purpose<BR> }<BR> }<BR>#endif //
USE_CLIENT_SESSION_MANAGEMENT</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2> // Remove all server media sessions (they'll
get deleted when they're finished):<BR> while (1) {<BR>
ServerMediaSession* serverMediaSession<BR> =
(ServerMediaSession*)fServerMediaSessions->RemoveNext();<BR>
if (serverMediaSession == NULL) break;<BR>
removeServerMediaSession(serverMediaSession);<BR> }</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2> // Finally, delete the session table
itself:<BR> delete fServerMediaSessions;<BR>#if
(USE_CLIENT_SESSION_MANAGEMENT)<BR> delete fRTSPClientSessions ;<BR>
<DIV>#endif // USE_CLIENT_SESSION_MANAGEMENT</DIV>
<DIV>[/code]</DIV>
<DIV> </DIV></DIV></FONT>
<DIV><FONT face=Arial size=2>In RTSPServer::RTSPClientSession constructor we
find</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>
<DIV>[code]</DIV></FONT><FONT face=Arial size=2>
fTCPStreamIdCount(0), fNumStreamStates(0), fStreamStates(NULL) {<BR>#if
(USE_CLIENT_SESSION_MANAGEMENT)<BR> char strKey[50] ;<BR> unsigned
__int64 ullAddress = (unsigned __int64)this ;<BR> sprintf( strKey,
"%I64u", ullAddress ) ;<BR> // add without check for previous existing
key<BR> fOurServer.fRTSPClientSessions->Add( strKey, this ) ;<BR>#endif
// USE_CLIENT_SESSION_MANAGEMENT<BR> // Arrange to handle incoming
requests:<BR></FONT><FONT face=Arial size=2><FONT face=Arial
size=2>[/code]</DIV>
<DIV> </DIV>
<DIV>and in RTSPServer::RTSPClientSession destructor we find</DIV>
<DIV> </DIV>
<DIV>
<DIV>[code]</DIV> reclaimStreamStates();</DIV>
<DIV> </DIV>
<DIV>#if (USE_CLIENT_SESSION_MANAGEMENT)<BR> char strKey[50] ;<BR>
unsigned __int64 ullAddress = (unsigned __int64)this ;<BR> sprintf(
strKey, "%I64u", ullAddress ) ;<BR>
fOurServer.fRTSPClientSessions->Remove( strKey ) ;<BR>#endif //
USE_CLIENT_SESSION_MANAGEMENT</DIV>
<DIV>[/code]</DIV>
<DIV> </DIV>
<DIV> Ross, is there any pitfall in this clientsession
management?</DIV>
<DIV> </DIV>
<DIV>Thank you very much,</DIV>
<DIV> </DIV>
<DIV> Renato</DIV>
<DIV> </DIV></FONT></FONT></FONT></DIV></BODY></HTML>