[Live-devel] Reclaiming live clientsessions

Renato MAURO (Libero) renatomauro at libero.it
Wed Jan 7 08:22:19 PST 2009


Hi Ross.

    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

  ----- Original Message ----- 
  From: sri kanth 
  To: live-devel at ns.live555.com 
  Sent: Tuesday, January 06, 2009 5:29 AM
  Subject: [Norton AntiSpam] [Live-devel] Memory leaks


  Hi Ross, 


                I am sending the file which describes regarding the memory leak in the code.


  Thanks,

  Viswajeet



------------------------------------------------------------------------------


  _______________________________________________
  live-devel mailing list
  live-devel at lists.live555.com
  http://lists.live555.com/mailman/listinfo/live-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20090107/0e98e343/attachment.html>


More information about the live-devel mailing list