[Live-devel] Reclaiming live clientsessions
Renato MAURO (Libero)
renatomauro at libero.it
Fri Jan 16 07:09:49 PST 2009
Hi Ross.
I sent this e-mail on jenuary the 7th in an existing thread. I apologize for my fault. Here it is same question.
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.
I solved this issue with some code and I'd like to know your opinion about my solution.
I defined fRTSPClientSessions in RTSPServer the same way it has fServerMediaSessions.
So in the RTSPServer constructor we find:
[code]
fServerMediaSessions(HashTable::create(STRING_HASH_KEYS)),
#if (USE_CLIENT_SESSION_MANAGEMENT)
fRTSPClientSessions(HashTable::create(STRING_HASH_KEYS)),
#endif // USE_CLIENT_SESSION_MANAGEMENT
[/code]
and in the RTSPServer destructor we find
[code]
::closeSocket(fServerSocket);
#if (USE_CLIENT_SESSION_MANAGEMENT)
// rimozione di eventuali client ancora presenti // deletion of live clients, if any
while (1) {
RTSPClientSession* rtspClientSession
= (RTSPClientSession*)fRTSPClientSessions->RemoveNext();
if (rtspClientSession == NULL) break;
try { delete rtspClientSession ; }catch(...)
{
int a = 10 ; // for debug purpose
}
}
#endif // USE_CLIENT_SESSION_MANAGEMENT
// Remove all server media sessions (they'll get deleted when they're finished):
while (1) {
ServerMediaSession* serverMediaSession
= (ServerMediaSession*)fServerMediaSessions->RemoveNext();
if (serverMediaSession == NULL) break;
removeServerMediaSession(serverMediaSession);
}
// Finally, delete the session table itself:
delete fServerMediaSessions;
#if (USE_CLIENT_SESSION_MANAGEMENT)
delete fRTSPClientSessions ;
#endif // USE_CLIENT_SESSION_MANAGEMENT
[/code]
In RTSPServer::RTSPClientSession constructor we find
[code]
fTCPStreamIdCount(0), fNumStreamStates(0), fStreamStates(NULL) {
#if (USE_CLIENT_SESSION_MANAGEMENT)
char strKey[50] ;
unsigned __int64 ullAddress = (unsigned __int64)this ;
sprintf( strKey, "%I64u", ullAddress ) ;
// add without check for previous existing key
fOurServer.fRTSPClientSessions->Add( strKey, this ) ;
#endif // USE_CLIENT_SESSION_MANAGEMENT
// Arrange to handle incoming requests:
[/code]
and in RTSPServer::RTSPClientSession destructor we find
[code]
reclaimStreamStates();
#if (USE_CLIENT_SESSION_MANAGEMENT)
char strKey[50] ;
unsigned __int64 ullAddress = (unsigned __int64)this ;
sprintf( strKey, "%I64u", ullAddress ) ;
fOurServer.fRTSPClientSessions->Remove( strKey ) ;
#endif // USE_CLIENT_SESSION_MANAGEMENT
[/code]
Ross, is there any pitfall in this clientsession management?
Thank you very much,
Renato
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20090116/0af7a3e7/attachment.html>
More information about the live-devel
mailing list