bool InspectorTracingAgent::isStarted() const { return !sessionId().isEmpty(); }
SSL_SESSION* SSLSessionCacheManager::getSession(SSL* ssl, unsigned char* session_id, int id_len, int* copyflag) { VLOG(7) << "SSL get session callback"; SSL_SESSION* session = nullptr; bool foreign = false; char const* missReason = nullptr; if (id_len < MIN_SESSION_ID_LENGTH) { // We didn't generate this session so it's going to be a miss. // This doesn't get logged or counted in the stats. return nullptr; } string sessionId((char*)session_id, id_len); AsyncSSLSocket* sslSocket = AsyncSSLSocket::getFromSSL(ssl); assert(sslSocket != nullptr); // look it up in the local cache first session = localCache_->lookupSession(sessionId); #ifdef SSL_SESSION_CB_WOULD_BLOCK if (session == nullptr && externalCache_) { // external cache might have the session foreign = true; if (!SSL_want_sess_cache_lookup(ssl)) { missReason = "reason: No async cache support;"; } else { PendingLookupMap::iterator pit = pendingLookups_.find(sessionId); if (pit == pendingLookups_.end()) { auto result = pendingLookups_.emplace(sessionId, PendingLookup()); // initiate fetch VLOG(4) << "Get SSL session [Pending]: Initiate Fetch; fd=" << sslSocket->getFd() << " id=" << SSLUtil::hexlify(sessionId); if (lookupCacheRecord(sessionId, sslSocket)) { // response is pending *copyflag = SSL_SESSION_CB_WOULD_BLOCK; return nullptr; } else { missReason = "reason: failed to send lookup request;"; pendingLookups_.erase(result.first); } } else { // A lookup was already initiated from this thread if (pit->second.request_in_progress) { // Someone else initiated the request, attach VLOG(4) << "Get SSL session [Pending]: Request in progess: attach; " "fd=" << sslSocket->getFd() << " id=" << SSLUtil::hexlify(sessionId); std::unique_ptr<DelayedDestruction::DestructorGuard> dg( new DelayedDestruction::DestructorGuard(sslSocket)); pit->second.waiters.emplace_back(sslSocket, std::move(dg)); *copyflag = SSL_SESSION_CB_WOULD_BLOCK; return nullptr; } // request is complete session = pit->second.session; // nullptr if our friend didn't have it if (session != nullptr) { CRYPTO_add(&session->references, 1, CRYPTO_LOCK_SSL_SESSION); } } } } #endif bool hit = (session != nullptr); if (stats_) { stats_->recordSSLSession(false, hit, foreign); } if (hit) { sslSocket->setSessionIDResumed(true); } VLOG(4) << "Get SSL session [" << ((hit) ? "Hit" : "Miss") << "]: " << ((foreign) ? "external" : "local") << " cache; " << ((missReason != nullptr) ? missReason : "") << "fd=" << sslSocket->getFd() << " id=" << SSLUtil::hexlify(sessionId); // We already bumped the refcount *copyflag = 0; return session; }
void InspectorTracingAgent::setLayerTreeId(int layerTreeId) { m_layerTreeId = layerTreeId; TRACE_EVENT_INSTANT1( devtoolsMetadataEventCategory, "SetLayerTreeId", TRACE_EVENT_SCOPE_THREAD, "data", InspectorSetLayerTreeId::data(sessionId(), m_layerTreeId)); }
// --------------------------------------------------------------------------- // CStunTurnTests::TestFetchCandidateL // --------------------------------------------------------------------------- // void CStunTurnTests::TestFetchCandidateL() { TUint sessionId( 0 ); TUint sessionId2( 0 ); TUint streamId( 0 ); TUint streamId2( 0 ); TUint streamId3( 0 ); TInt error; TInt loadedPluginInd( 0 ); RDebug::Print( _L( "TEST PRINT: Create session" ) ); sessionId = iNat.CreateSessionL( iTestIapId, iTestDomain->Des() ); iIfStub.StartActiveSchedulerL(); RDebug::Print( _L( "TEST PRINT: Create stream" ) ); streamId = iNat.CreateStreamL( sessionId, iProtocol, KDefaultQos ); RDebug::Print( _L( "TEST PRINT: Load plugin" ) ); iNat.LoadPluginL( sessionId, *iPlugins, loadedPluginInd ); iIfStub.StartActiveSchedulerL( KPluginLoadTime ); RDebug::Print( _L( "\nTEST CASE: Fetch Candidate to the stream" ) ); TRAPD( err, iNat.FetchCandidateL( sessionId, streamId, KAfInet ) ); if ( err ) { RDebug::Print( _L( "\nTEST PRINT: CNATFWClient::FetchCandidateL LEAVE %d" ), err ); iNat.CloseStreamL( sessionId, streamId ); iNat.CloseSessionL( sessionId ); User::Leave( err ); } error = iIfStub.StartActiveSchedulerL( /*KRunningTime*/ ); RDebug::Print( _L( "TEST PRINT: Close the stream and the session" ) ); iNat.CloseStreamL( sessionId, streamId ); iNat.CloseSessionL( sessionId ); __ASSERT_ALWAYS( !error, User::Leave( error )); RDebug::Print( _L( "TEST PRINT: Create session 1" ) ); sessionId = iNat.CreateSessionL( iTestIapId, iTestDomain->Des() ); iIfStub.StartActiveSchedulerL(); RDebug::Print( _L( "TEST PRINT: Load plugin to session 1" ) ); iNat.LoadPluginL( sessionId, *iPlugins, loadedPluginInd ); iIfStub.StartActiveSchedulerL( KPluginLoadTime ); RDebug::Print( _L( "TEST PRINT: Create stream 1 to the session 1" ) ); streamId = iNat.CreateStreamL( sessionId, iProtocol, KDefaultQos ); RDebug::Print( _L( "\nTEST CASE: Fetch Candidate to the stream 1 in the session 1" ) ); TRAP( err, iNat.FetchCandidateL( sessionId, streamId, KAfInet ) ); if( err ) { RDebug::Print( _L( "\nTEST PRINT: CNATFWClient::FetchCandidateL LEAVE %d" ), err ); iNat.CloseStreamL( sessionId, streamId ); iNat.CloseSessionL( sessionId ); User::Leave( err ); } iIfStub.StartActiveSchedulerL(); RDebug::Print( _L( "TEST PRINT: Create stream 2 to the session 1" ) ); streamId2 = iNat.CreateStreamL( sessionId, iProtocol, KDefaultQos ); RDebug::Print( _L( "\nTEST CASE: Fetch Candidate to the stream 2 in the session 1" ) ); TRAP( err, iNat.FetchCandidateL( sessionId, streamId2, KAfInet ) ); if( err ) { RDebug::Print( _L( "\nTEST PRINT: CNATFWClient::FetchCandidateL LEAVE %d" ), err ); iNat.CloseStreamL( sessionId, streamId ); iNat.CloseStreamL( sessionId, streamId2 ); iNat.CloseSessionL( sessionId ); User::Leave( err ); } error = iIfStub.StartActiveSchedulerL( KRunningTime ); if( !error ) { RDebug::Print( _L( "TEST PRINT: Create session 2" ) ); sessionId2 = iNat.CreateSessionL( iTestIapId, iTestDomain->Des() ); iIfStub.StartActiveSchedulerL(); RDebug::Print( _L( "TEST PRINT: Load plugin to session 2" ) ); iNat.LoadPluginL( sessionId2, *iPlugins, loadedPluginInd ); iIfStub.StartActiveSchedulerL( KPluginLoadTime ); RDebug::Print( _L( "TEST PRINT: Create stream 3 to the session 2" ) ); streamId3 = iNat.CreateStreamL( sessionId2, iProtocol, KDefaultQos ); RDebug::Print( _L( "\nTEST CASE: Fetch Candidate to the stream 3 in the session 2" ) ); TRAP( err, iNat.FetchCandidateL( sessionId2, streamId3, KAfInet ) ); if( err ) { RDebug::Print( _L( "\nTEST PRINT: CNATFWClient::FetchCandidateL LEAVE %d" ), err ); iNat.CloseStreamL( sessionId2, streamId3 ); iNat.CloseSessionL( sessionId2 ); iNat.CloseStreamL( sessionId, streamId ); iNat.CloseStreamL( sessionId, streamId2 ); iNat.CloseSessionL( sessionId ); User::Leave( err ); } iIfStub.StartActiveSchedulerL( KRunningTime ); RDebug::Print( _L( "TEST PRINT: Close stream 3 and session 2" ) ); iNat.CloseStreamL( sessionId2, streamId3 ); iNat.CloseSessionL( sessionId2 ); } RDebug::Print( _L( "TEST PRINT: Close streams 1 & 2 and session 1" ) ); iNat.CloseStreamL( sessionId, streamId ); iNat.CloseStreamL( sessionId, streamId2 ); iNat.CloseSessionL( sessionId ); __ASSERT_ALWAYS( !error, User::Leave( error )); }
// --------------------------------------------------------------------------- // 2nd phase constructor // --------------------------------------------------------------------------- // void CCatalogsHttpDownloadManager::ConstructL( TBool aCleanup ) { DLTRACEIN(("")); User::LeaveIfError( iFs.Connect() ); // shared so that RFiles can be given to Download manager User::LeaveIfError( iFs.ShareProtected() ); QString DmgrUid(QString::number(KNCDEngineAppID)); iDmgr = new DownloadManager(DmgrUid); iDmgr->initialize(); iQTmgr = new CCatalogsHttpQTDownloadManager(this,iDmgr); TUid sessionId( TUid::Uid( iSessionId ) ); if ( aCleanup ) { DLTRACE(("Cleaning download manager before connecting")); TUidName client( CleanUidName( sessionId ) ); TPath path; path.Format( KCatalogsDownloadMgrPath, &client ); CFileMan* fileman = CFileMan::NewL( iFs ); CleanupStack::PushL( fileman ); DLINFO(( _L("Clearing directory: %S"), &path )); // Ignoring errors fileman->Delete( path ); CleanupStack::PopAndDestroy( fileman ); } // Connect with the download manager // If the 3rd parameter == ETrue, this session inherits downloads // from other sessions that have the same UID. TInt err = KErrNone; TInt retries = KCatalogsDlMgrConnectRetryAttempts; do { if ( err != KErrNone ) { DLERROR(("DL manager connection failed with err: %d, retry attempts left", err, retries )); // This halts the whole thread which is not nice but shouldn't // be a problem since this should occur only when the download // manager is being shutdown when we try to connect to it User::After( KCatalogsDlMgrConnectRetryInterval ); } } while ( err != KErrNone && retries-- ); if( err != KErrNone ) { DLINFO(("Leaving.. DL manager connection failed with: %d", err )); User::Leave( err ); } DLTRACE(("ConnectL ok")); iDefaultConfig = CCatalogsHttpConfig::NewL(); iNetworkManager = &CCatalogsHttpSessionManager::NetworkManagerL(); iNetworkManager->AddObserverL( *this ); // Restore downloads from previous sessions // RestoreDownloadsL(); DLTRACEOUT(("")); }
const bool BasicMessageProcessor::shouldProcessMessage(const CoreMessage* message) { return (message->messageType() == CoreMessage::SERVICE_REQUEST || message->messageType() == CoreMessage::SERVICE_RESPONSE || message->messageType() == CoreMessage::KILL_SESSION_REQUEST) && message->sessionId() == sessionId(); }
/** Perform CX3pStep3 test step. This test verifies that the Test Protocol Module correctly handles X3P cancellation. Cancellation occurs after gateway receives location request. @return TVerdict test result code */ TVerdict CX3pStep3::doTestStepL() { INFO_PRINTF1(_L("\t********************************************************************")); INFO_PRINTF1(_L("\tX3P with cancel sent after loc request received")); INFO_PRINTF1(_L("\t********************************************************************")); INFO_PRINTF1(_L("- START -")); // Initiate X3P INFO_PRINTF1(_L("\tLBS -> TransmitLocation")); TLbsAsistanceDataGroup dataRequestMask = (TUint) EAssistanceDataReferenceTime; TLbsNetSessionId sessionId(TUid::Uid(KDummyUid), KX3pSessionId); iModule->RequestTransmitLocation(sessionId, KX3pDestination(), KX3pPriority); // Check network receives X3P request if (EFail == CheckNetworkCallbackL( CNetworkObserver::ERegisterLcsMoLr) || KX3pDestination() != iNetworkObserver->X3pDestination()) { SetTestStepResult(EFail); return TestStepResult(); } INFO_PRINTF1(_L("\t RegisterLcsMoLr -> NET")); // Generate network Measurement Control INFO_PRINTF1(_L("\t ProcessMeasurementControlLocation <- NET")); TPositionInfo refLoc; RLbsAssistanceDataBuilderSet assistData; CleanupClosePushL(assistData); assistData.OpenL(); SetDummyAssistanceData(assistData, dataRequestMask); TLbsNetPosRequestQuality quality; iNetworkObserver->ProcessMeasurementControlLocationL(refLoc, assistData, quality); CleanupStack::PopAndDestroy(&assistData); // Check gateway receives Assistance data if (EFail == CheckGatewayCallbackL( CGatewayObserver::EProcessAssistanceData)) { SetTestStepResult(EFail); return TestStepResult(); } INFO_PRINTF1(_L("\tLBS <- ProcessAssistanceData")); // Check gateway receives Network Based location if (EFail == CheckGatewayCallbackL( CGatewayObserver::EProcessLocationUpdate)) { SetTestStepResult(EFail); return TestStepResult(); } INFO_PRINTF1(_L("\tLBS <- ProcessLocationUpdate")); // Check gateway receives Location Request if (EFail == CheckGatewayCallbackL( CGatewayObserver::EProcessLocationRequest)) { SetTestStepResult(EFail); return TestStepResult(); } INFO_PRINTF1(_L("\tLBS <- ProcessLocationRequest")); // Cancel X3P INFO_PRINTF1(_L("\tLBS -> CancelTransmitLocation (REASON)")); iModule->CancelTransmitLocation(iGatewayObserver->SessionIdValue(), KErrGeneral); // Check network receives cancel response if (EFail == CheckNetworkCallbackL(CNetworkObserver::EMeasurementControlFailure) || KErrCancel != iNetworkObserver->MeasurementFailure()) { SetTestStepResult(EFail); return TestStepResult(); } INFO_PRINTF1(_L("\t MeasurementControlFailure (CANCEL) -> NET")); // Check network session completed if (EFail == CheckNetworkCallbackL( CNetworkObserver::EReleaseLcsMoLr) || KErrGeneral != iNetworkObserver->SessionCloseReason()) { SetTestStepResult(EFail); return TestStepResult(); } INFO_PRINTF1(_L("\t ReleaseLcsMoLr (REASON) -> NET")); // Check gateway session completed if (EFail == CheckGatewayCallbackL(CGatewayObserver::EProcessSessionComplete) || sessionId != iGatewayObserver->SessionIdValue() || KErrGeneral != iGatewayObserver->SessionCloseReason()) { SetTestStepResult(EFail); return TestStepResult(); } INFO_PRINTF1(_L("\tLBS <- ProcessSessionComplete")); // Check if more observer activity takes place if (iGatewayObserver->IsMoreObserverActivity() || iNetworkObserver->IsMoreObserverActivity()) { SetTestStepResult(EFail); return TestStepResult(); } INFO_PRINTF1(_L("- END -")); SetTestStepResult(EPass); return TestStepResult(); }