datacommsserver/esockserver/ssock/ss_mmcommsprov.cpp
branchRCL_3
changeset 12 8b5d60ce1e94
parent 0 dfb7c4ff071f
child 18 9644881fedd0
equal deleted inserted replaced
11:98a7181d2ce7 12:8b5d60ce1e94
    17  @file SS_NODE.CPP
    17  @file SS_NODE.CPP
    18 */
    18 */
    19 
    19 
    20 #include "ss_mmcommsprov.h"
    20 #include "ss_mmcommsprov.h"
    21 #include <elements/nm_messages_child.h>
    21 #include <elements/nm_messages_child.h>
    22 
    22 #include <elements/mm_activities.h> 
       
    23 #include "ss_nodemessages_internal.h"
       
    24 #include "ss_internal_activities.h"
    23 
    25 
    24 #ifdef _DEBUG
    26 #ifdef _DEBUG
    25 // Panic category for "absolutely impossible!" vanilla ASSERT()-type panics from this module
    27 // Panic category for "absolutely impossible!" vanilla ASSERT()-type panics from this module
    26 // (if it could happen through user error then you should give it an explicit, documented, category + code)
    28 // (if it could happen through user error then you should give it an explicit, documented, category + code)
    27 _LIT(KSpecAssert_ESockSSocksmcmsp, "ESockSSocksmcmsp");
    29 _LIT(KSpecAssert_ESockSSocksmcmsp, "ESockSSocksmcmsp");
   110 	aInterface = this;
   112 	aInterface = this;
   111 	}
   113 	}
   112 
   114 
   113 void CMMCommsProviderBase::DestroyOrphanedDataClients()
   115 void CMMCommsProviderBase::DestroyOrphanedDataClients()
   114 	{
   116 	{
   115 	//Destroy orphaned data clients
   117     // Note: If PRDataClientStopActivity is running, it will call PRStates::TDestroyOrphanedDataClients
   116 	RNodeInterface* dc;
   118     // once it has stopped the data clients, so we don't need to start PRDestroyOrphans activity here.
   117 	TClientIter<TDefaultClientMatchPolicy> iter = GetClientIter<TDefaultClientMatchPolicy>(TClientType(TCFClientType::EData));
   119     // What was happening before was that we were destroying the Default data client before one or more
   118 	while ((dc = iter++) != NULL)
   120     // non-Default clients.  This causes problems due to internal references between some non-Default
       
   121     // and Default data client types.
       
   122 	if (CountClients<TDefaultClientMatchPolicy>(
       
   123 	        TClientType(TCFClientType::EData),
       
   124 	        TClientType(0, TCFClientType::EActive|TCFClientType::EActivating|TCFClientType::ELeaving|TCFClientType::EStarted|TCFClientType::EStarting))
       
   125 		&& CountActivities(ECFActivityDestroyOrphans) == 0
       
   126 		&& CountActivities(ECFActivityDestroy) == 0
       
   127 	    && CountActivities(ECFActivityStopDataClient) == 0)
   119 		{
   128 		{
   120 		if (!(dc->Flags()&(TCFClientType::EActive|TCFClientType::EActivating|TCFClientType::ELeaving|TCFClientType::EStarted|TCFClientType::EStarting)))
   129 		RNodeInterface::OpenPostMessageClose(Id(), Id(), TCFMessage::TDestroyOrphans().CRef());
   121 			{
       
   122 			//AbortActivitiesOriginatedBy(dc->RecipientId(),aContext);
       
   123 			dc->PostMessage(Id(), TEChild::TDestroy().CRef());
       
   124 			dc->SetFlags(TClientType::ELeaving);
       
   125 			}
       
   126 		}
   130 		}
   127 	}
   131 	}
   128 
   132 
   129 
   133