commsfwsupport/commselements/serverden/src/sd_player.cpp
branchRCL_3
changeset 9 77effd21b2c9
parent 0 dfb7c4ff071f
child 50 afebdb533a85
equal deleted inserted replaced
5:68ef71f0cd72 9:77effd21b2c9
    56 		}
    56 		}
    57 	}
    57 	}
    58 
    58 
    59 void CCommonSessionProxy::BeginSessionClose()
    59 void CCommonSessionProxy::BeginSessionClose()
    60 	{
    60 	{
    61 	//COMMONLOG((WorkerId(),KECommonBootingTag, _L8("CSockSessionProxy %08x:\tBeginSessionClose(), iSockSession %08x"), this, iSession) );
    61 	COMMONLOG((Player().WorkerId(),KECommonBootingTag, _L8("CCommonSessionProxy %08x:\tBeginSessionClose(), iSockSession %08x"), this, iSession) );
    62 	/* Only do something if the message is within the deadline and we're sure
    62 	/* Only do something if the message is within the deadline and we're sure
    63 	   the session pointer is safe to use */
    63 	   the session pointer is safe to use */
    64 	CCommonWorkerThread& worker = iPlayer.WorkerThread();
    64 	CCommonWorkerThread& worker = iPlayer.WorkerThread();
    65 	worker.IncProlongBindingLife();
    65 	worker.IncProlongBindingLife();
    66 	__ASSERT_DEBUG(!IsClosing(), User::Panic(KSpecAssert_ElemSvrDenPlayrC, 1));
    66 	__ASSERT_DEBUG(!IsClosing(), User::Panic(KSpecAssert_ElemSvrDenPlayrC, 1));
    85 	NotifySubSessionDestroyed();	// remove the dummy subsession
    85 	NotifySubSessionDestroyed();	// remove the dummy subsession
    86 	}
    86 	}
    87 
    87 
    88 EXPORT_C void CCommonSessionProxy::NotifySubSessionDestroyed()
    88 EXPORT_C void CCommonSessionProxy::NotifySubSessionDestroyed()
    89 	{
    89 	{
    90 	//COMMONLOG((WorkerId(),KECommonBootingTag, _L8("CSockSessionProxy %08x:\tNotifySubSessionDestroyed(), iSockSession %08x"), this, iSession) );
    90 	//COMMONLOG((Player().WorkerId(),KECommonBootingTag, _L8("CCommonSessionProxy %08x:\tNotifySubSessionDestroyed(), iSockSession %08x"), this, iSession) );
    91 	if(IsClosing() && --iNumSubSessClosing <= 0)
    91 	if(IsClosing() && --iNumSubSessClosing <= 0)
    92 		{
    92 		{
    93 		__ASSERT_DEBUG(iNumSubSessClosing == 0, User::Panic(KSpecAssert_ElemSvrDenPlayrC, 2));
    93 		__ASSERT_DEBUG(iNumSubSessClosing == 0, User::Panic(KSpecAssert_ElemSvrDenPlayrC, 2));
    94 		CCommonWorkerThread& worker = iPlayer.WorkerThread();
    94 		CCommonWorkerThread& worker = iPlayer.WorkerThread();
    95 		worker.CompleteSessionClose(iSession);
    95 		worker.CompleteSessionClose(iSession);
   200 			{
   200 			{
   201 			COMMONLOG((WorkerId(),KECommonBootingTag, _L8("-- can't; subsess %08x belongs to this peer"), ss) );
   201 			COMMONLOG((WorkerId(),KECommonBootingTag, _L8("-- can't; subsess %08x belongs to this peer"), ss) );
   202 			return EFalse;
   202 			return EFalse;
   203 			}
   203 			}
   204 		}
   204 		}
   205 	return ETrue;
   205     
       
   206 	if (!iSessionProxies.IsEmpty())
       
   207         {
       
   208         COMMONLOG((WorkerId(), KECommonBootingTag, _L8("-- can't; session proxies still present")));
       
   209         return EFalse;
       
   210         }
       
   211     
       
   212 
       
   213     return ETrue;
   206 	}
   214 	}
   207 
   215 
   208 EXPORT_C void CCommonPlayer::MaybeSetPlayerShutdownComplete(TBool aForceShutdownNow)
   216 EXPORT_C void CCommonPlayer::MaybeSetPlayerShutdownComplete(TBool aForceShutdownNow)
   209 	{
   217 	{
   210 	//A forced shutdown trumps all other considerations
   218 	//A forced shutdown trumps all other considerations
   211 	TBool shutdownComplete = aForceShutdownNow || (SubSessions().Count() == 0 && IsPlayerShutdownComplete());
   219 	TBool shutdownComplete = aForceShutdownNow
       
   220 	        || (SubSessions().Count() == 0  && iSessionProxies.IsEmpty() && IsPlayerShutdownComplete());
   212 
   221 
   213 	COMMONLOG((WorkerId(), KECommonBootingTag, _L8("CPlayer::MaybeSetPlayerShutdownComplete(), shutdownComplete = %d [forced=%d, #subSess=%d]"),
   222 	COMMONLOG((WorkerId(), KECommonBootingTag, _L8("CPlayer::MaybeSetPlayerShutdownComplete(), shutdownComplete = %d [forced=%d, #subSess=%d]"),
   214 		shutdownComplete, aForceShutdownNow, SubSessions().Count()));
   223 		shutdownComplete, aForceShutdownNow, SubSessions().Count()));
   215 
   224 
   216 	WorkerThread().SetPlayerShutdownComplete(shutdownComplete);
   225 	WorkerThread().SetPlayerShutdownComplete(shutdownComplete);