datacommsserver/esockserver/core_states/ss_coreprstates.cpp
changeset 40 34fc115b8742
parent 22 592244873960
child 50 afebdb533a85
equal deleted inserted replaced
34:6646e488a904 40:34fc115b8742
  1331     	}
  1331     	}
  1332 	}
  1332 	}
  1333 
  1333 
  1334 EXPORT_DEFINE_SMELEMENT(TAwaitingStarted, NetStateMachine::MState, CoreNetStates::TContext)
  1334 EXPORT_DEFINE_SMELEMENT(TAwaitingStarted, NetStateMachine::MState, CoreNetStates::TContext)
  1335 EXPORT_C TBool TAwaitingStarted::Accept()
  1335 EXPORT_C TBool TAwaitingStarted::Accept()
  1336 	{
  1336     {
  1337     if (iContext.iMessage.IsMessage<TCFServiceProvider::TStarted>())
  1337     if (iContext.iMessage.IsMessage<TCFServiceProvider::TStarted>())
  1338         {
  1338         {
  1339 	    if (iContext.iPeer)
  1339         if (iContext.iPeer)
  1340 	        {
  1340             {
  1341 			iContext.iPeer->ClearFlags(TCFClientType::EStarting);
  1341             iContext.iPeer->ClearFlags(TCFClientType::EStarting);
  1342 	        iContext.iPeer->SetFlags(TCFClientType::EStarted);
  1342             iContext.iPeer->SetFlags(TCFClientType::EStarted);
  1343 	        }
  1343             }
  1344 	    return ETrue;
  1344         if (iContext.iNodeActivity)
  1345         }
  1345             {//The node has responded. Core providers doesn't support the notion of multiple service providers,
  1346 
  1346              //therefore this code has been written to expect that TCFServiceProvider::TStart would only ever be
  1347 	//If this is TError, clean the EStarting flag but do not accept, clean or otherwise process
  1347              //sent to one service provider as a simple request<>response handshake. The client has now responded
  1348 	if (iContext.iMessage.IsMessage<TEBase::TError>())
  1348              //and its job is now done. ClearPostedTo so that TCancels aren't forwarded.
  1349     	{
  1349             iContext.iNodeActivity->ClearPostedTo();
  1350 	    if (iContext.iPeer)
  1350             }
  1351 	        {
  1351         return ETrue;
  1352 	        iContext.iPeer->ClearFlags(TCFClientType::EStarting);
  1352         }
  1353 	        }
  1353 
  1354     	}
  1354     //If this is TError, clean the EStarting flag but do not accept, clean or otherwise process
  1355 
  1355     if (iContext.iMessage.IsMessage<TEBase::TError>())
  1356 	return EFalse;
  1356         {
  1357 	}
  1357         if (iContext.iPeer)
       
  1358             {
       
  1359             iContext.iPeer->ClearFlags(TCFClientType::EStarting);
       
  1360             }
       
  1361         if (iContext.iNodeActivity)
       
  1362             {//The node has responded. Core providers doesn't support the notion of multiple service providers,
       
  1363              //therefore this code has been written to expect that TCFServiceProvider::TStart would only ever be
       
  1364              //sent to one service provider as a simple request<>response handshake. The client has now responded
       
  1365              //and its job is now done. ClearPostedTo so that TCancels aren't forwarded.
       
  1366             iContext.iNodeActivity->ClearPostedTo();
       
  1367             }
       
  1368         }
       
  1369 
       
  1370     return EFalse;
       
  1371     }
  1358 
  1372 
  1359 EXPORT_DEFINE_SMELEMENT(TSendBindToComplete, NetStateMachine::MStateTransition, CoreNetStates::TContext)
  1373 EXPORT_DEFINE_SMELEMENT(TSendBindToComplete, NetStateMachine::MStateTransition, CoreNetStates::TContext)
  1360 EXPORT_C void TSendBindToComplete::DoL()
  1374 EXPORT_C void TSendBindToComplete::DoL()
  1361 	{
  1375 	{
  1362 	__ASSERT_DEBUG(iContext.iNodeActivity, CorePrPanic(KPanicNoActivity));
  1376 	__ASSERT_DEBUG(iContext.iNodeActivity, CorePrPanic(KPanicNoActivity));
  1889 //-=========================================================
  1903 //-=========================================================
  1890 
  1904 
  1891 EXPORT_DEFINE_SMELEMENT(TForwardStateChange, NetStateMachine::MStateTransition, PRStates::TContext)
  1905 EXPORT_DEFINE_SMELEMENT(TForwardStateChange, NetStateMachine::MStateTransition, PRStates::TContext)
  1892 EXPORT_C void TForwardStateChange::DoL()
  1906 EXPORT_C void TForwardStateChange::DoL()
  1893 	{
  1907 	{
  1894 	//Forward to control clients if there are any
  1908     //In some cirumstances a node can have more than one TCFClientType::EServProvider peer (for instance MCPRs can have more than one potential service provider), 
       
  1909     //but within the coreprovider code there is no concept of multiple service providers per-se. There is only one service provider and it is the TCFClientType::EServProvider 
       
  1910     //with TCFClientType::EActive flag set. If a progress comes from a TCFClientType::EServProvider that is not a service provider, the progress will be ignored here.
       
  1911 
       
  1912     if (iContext.iPeer && 
       
  1913         iContext.iPeer->Type() == TCFClientType::EServProvider && 
       
  1914         !(iContext.iPeer->Flags() & TCFClientType::EActive) )
       
  1915         {
       
  1916         return;
       
  1917         }
  1895 	TInt ctrlClientCount = iContext.Node().PostToClients<TDefaultClientMatchPolicy>(TNodeCtxId(iContext.ActivityId(), iContext.NodeId()), iContext.iMessage, TClientType(TCFClientType::ECtrl));
  1918 	TInt ctrlClientCount = iContext.Node().PostToClients<TDefaultClientMatchPolicy>(TNodeCtxId(iContext.ActivityId(), iContext.NodeId()), iContext.iMessage, TClientType(TCFClientType::ECtrl));
  1896 	if (0==ctrlClientCount)
  1919 	if (0==ctrlClientCount)
  1897 		{ //If there are no control clients any more, forward to the control provider
  1920 		{ //If there are no control clients any more, forward to the control provider
  1898 		iContext.Node().PostToClients<TDefaultClientMatchPolicy>(TNodeCtxId(iContext.ActivityId(), iContext.NodeId()), iContext.iMessage, TClientType(TCFClientType::ECtrlProvider));
  1921 		iContext.Node().PostToClients<TDefaultClientMatchPolicy>(TNodeCtxId(iContext.ActivityId(), iContext.NodeId()), iContext.iMessage, TClientType(TCFClientType::ECtrlProvider));
  1899 		}
  1922 		}