datacommsserver/esockserver/ssock/ss_mmcommsprov.cpp
branchRCL_3
changeset 18 9644881fedd0
parent 12 8b5d60ce1e94
child 23 cbb19216b74d
equal deleted inserted replaced
17:9ddb1d67ebaf 18:9644881fedd0
    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 #include <elements/mm_activities.h> 
    22 #include <elements/mm_activities.h>
       
    23 #include <comms-infras/corecpractivities.h> 
    23 #include "ss_nodemessages_internal.h"
    24 #include "ss_nodemessages_internal.h"
    24 #include "ss_internal_activities.h"
    25 #include "ss_internal_activities.h"
    25 
    26 
    26 #ifdef _DEBUG
    27 #ifdef _DEBUG
    27 // Panic category for "absolutely impossible!" vanilla ASSERT()-type panics from this module
    28 // Panic category for "absolutely impossible!" vanilla ASSERT()-type panics from this module
    29 _LIT(KSpecAssert_ESockSSocksmcmsp, "ESockSSocksmcmsp");
    30 _LIT(KSpecAssert_ESockSSocksmcmsp, "ESockSSocksmcmsp");
    30 #endif
    31 #endif
    31 
    32 
    32 using namespace ESock;
    33 using namespace ESock;
    33 using namespace Messages;
    34 using namespace Messages;
       
    35 
       
    36 //We reserve space for two preallocated activities that may start concurrently on the connection
       
    37 //node: destroy (connection close) and connection stop.
       
    38 static const TUint KMaxPreallocatedActivitySize = sizeof(MeshMachine::CNodeRetryParallelActivity) + sizeof(MeshMachine::APreallocatedOriginators<4>);
    34 
    39 
    35 CMMCommsProviderBase::CMMCommsProviderBase(CCommsFactoryBase& aFactory,
    40 CMMCommsProviderBase::CMMCommsProviderBase(CCommsFactoryBase& aFactory,
    36                                     const MeshMachine::TNodeActivityMap& aActivityMap)
    41                                     const MeshMachine::TNodeActivityMap& aActivityMap)
    37 :	ACommsFactoryNodeId(aFactory),
    42 :	ACommsFactoryNodeId(aFactory),
    38 	ACFMMNodeBase(aActivityMap, ANodeId::Id()),
    43 	ACFMMNodeBase(aActivityMap, ANodeId::Id()),
   110 EXPORT_C void CMMCommsProviderBase::ReturnInterfacePtrL(MAccessPointConfigApi*& aInterface)
   115 EXPORT_C void CMMCommsProviderBase::ReturnInterfacePtrL(MAccessPointConfigApi*& aInterface)
   111 	{
   116 	{
   112 	aInterface = this;
   117 	aInterface = this;
   113 	}
   118 	}
   114 
   119 
       
   120 EXPORT_C RNodeInterface* CMMCommsProviderBase::AddClientL(const Messages::TNodeId& aClientId, const Messages::TClientType& aClientType, TAny* aClientInfo)
       
   121 	{
       
   122 	RNodeInterface* nodeInterface = ANodeBase::AddClientL(aClientId, aClientType, aClientInfo);
       
   123 
       
   124 	if(aClientType.Type() == TCFClientType::ECtrl)
       
   125 		{
       
   126 		TRAPD(err, nodeInterface->PreAllocL(KMaxPreallocatedActivitySize));
       
   127 		if(err!=KErrNone)
       
   128 			{
       
   129 			RemoveClient(nodeInterface->RecipientId());
       
   130 			User::Leave(err);
       
   131 			}
       
   132 		}
       
   133 
       
   134 	return nodeInterface;
       
   135 	}
       
   136 
   115 void CMMCommsProviderBase::DestroyOrphanedDataClients()
   137 void CMMCommsProviderBase::DestroyOrphanedDataClients()
   116 	{
   138 	{
   117     // Note: If PRDataClientStopActivity is running, it will call PRStates::TDestroyOrphanedDataClients
   139     // Note: If PRDataClientStopActivity is running, it will call PRStates::TDestroyOrphanedDataClients
   118     // once it has stopped the data clients, so we don't need to start PRDestroyOrphans activity here.
   140     // once it has stopped the data clients, so we don't need to start PRDestroyOrphans activity here.
   119     // What was happening before was that we were destroying the Default data client before one or more
   141     // What was happening before was that we were destroying the Default data client before one or more