void _pmdController::releaseSessionInfo( const string & sessionID ) { restSessionInfo *pInfo = NULL ; map<string, restSessionInfo*>::iterator it ; _ctrlLatch.get() ; it = _mapSessions.find( sessionID ) ; if ( it != _mapSessions.end() ) { pInfo = it->second ; _delFromUserMap( pInfo->_attr._userName, pInfo ) ; if ( pInfo->isLock() ) { detachSessionInfo( pInfo ) ; } if ( !pInfo->isIn() ) { SDB_OSS_DEL pInfo ; _mapSessions.erase( it ) ; } else { _invalidSessionInfo( pInfo ) ; } } _ctrlLatch.release() ; }
// Check and mark timeout session as invalid void _pmdController::_checkSession( UINT32 interval ) { map<string, restSessionInfo*>::iterator it ; restSessionInfo *pInfo = NULL ; _ctrlLatch.get() ; it = _mapSessions.begin() ; while ( it != _mapSessions.end() ) { pInfo = it->second ; if ( pInfo->isIn() ) { ++it ; continue ; } if ( pInfo->isValid() ) { pInfo->onTimer( interval ) ; if ( pInfo->isTimeout( PMD_REST_SESSION_TIMEOUT ) ) { pInfo->invalidate() ; } } // If the session is marked invalid, let's delete the memory if ( !pInfo->isValid() ) { _delFromUserMap( pInfo->_attr._userName, pInfo ) ; SDB_OSS_DEL pInfo ; _mapSessions.erase( it++ ) ; continue ; } ++it ; } _ctrlLatch.release() ; }