--- a/commsfwsupport/commselements/meshmachine/inc/mm_activities.h Tue Aug 03 15:29:29 2010 +0100
+++ b/commsfwsupport/commselements/meshmachine/inc/mm_activities.h Tue Aug 24 14:43:02 2010 +0100
@@ -91,7 +91,7 @@
#define DEFINE_EXPORT_CUSTOM_NODEACTIVITY( id, name, msgtype, ctor ) \
EXPORT_C const MeshMachine::TNodeActivity& name :: Self() {return iSelf;} \
EXPORT_C const NetStateMachine::TStateTriple& name :: FirstTriple() {return iData[1];} \
- const MeshMachine::TNodeActivity name :: iSelf = {id, 0, msgtype::EId, msgtype::ERealm, name :: iData[1], (TAny*)&ctor, _S8(#name)}; \
+ const MeshMachine::TNodeActivity name :: iSelf = {id, MeshMachine::TNodeActivity::ENodeCtor, msgtype::EId, msgtype::ERealm, name :: iData[1], (TAny*)&ctor, _S8(#name)}; \
DEFINE_TRIPLES_TABLE( name :: iData )
/**
@@ -110,7 +110,7 @@
@see CNodeActivityBase
*/
#define DEFINE_CUSTOM_NODEACTIVITY( id, name, msgtype, ctor ) \
- const MeshMachine::TNodeActivity name :: iSelf = {id, 0, msgtype::EId, msgtype::ERealm, name :: iData[1], (TAny*)&ctor, _S8(#name)}; \
+ const MeshMachine::TNodeActivity name :: iSelf = {id, MeshMachine::TNodeActivity::ENodeCtor, msgtype::EId, msgtype::ERealm, name :: iData[1], (TAny*)&ctor, _S8(#name)}; \
DEFINE_TRIPLES_TABLE( name :: iData )
#else
@@ -128,7 +128,7 @@
#define DEFINE_EXPORT_CUSTOM_NODEACTIVITY( id, name, msgtype, ctor ) \
EXPORT_C const MeshMachine::TNodeActivity& name :: Self() {return iSelf;} \
EXPORT_C const NetStateMachine::TStateTriple& name :: FirstTriple() {return iData[1];} \
- const MeshMachine::TNodeActivity name :: iSelf = {id, 0, msgtype::EId, msgtype::ERealm, name :: iData[1], (TAny*)&ctor, NULL}; \
+ const MeshMachine::TNodeActivity name :: iSelf = {id, MeshMachine::TNodeActivity::ENodeCtor, msgtype::EId, msgtype::ERealm, name :: iData[1], (TAny*)&ctor, NULL}; \
DEFINE_TRIPLES_TABLE( name :: iData )
/**
@@ -147,7 +147,7 @@
@see CNodeActivityBase
*/
#define DEFINE_CUSTOM_NODEACTIVITY( id, name, msgtype, ctor ) \
- const MeshMachine::TNodeActivity name :: iSelf = {id, 0, msgtype::EId, msgtype::ERealm, name :: iData[1], (TAny*)&ctor, NULL}; \
+ const MeshMachine::TNodeActivity name :: iSelf = {id, MeshMachine::TNodeActivity::ENodeCtor, msgtype::EId, msgtype::ERealm, name :: iData[1], (TAny*)&ctor, NULL}; \
DEFINE_TRIPLES_TABLE( name :: iData )
#endif
@@ -476,7 +476,7 @@
*/
#define DEFINE_RESERVED_CUSTOM_NODEACTIVITY( id, name, msgtype, ctor ) \
- const MeshMachine::TNodeActivity name :: iSelf = {id, 1, msgtype::EId, msgtype::ERealm, name :: iData[1], (TAny*)&ctor, _S8(#name)}; \
+ const MeshMachine::TNodeActivity name :: iSelf = {id, MeshMachine::TNodeActivity::EContextCtor, msgtype::EId, msgtype::ERealm, name :: iData[1], (TAny*)&ctor, _S8(#name)}; \
DEFINE_TRIPLES_TABLE( name :: iData )
#else
@@ -494,7 +494,7 @@
#define DEFINE_RESERVED_EXPORT_CUSTOM_NODEACTIVITY( id, name, msgtype, ctor ) \
EXPORT_C const MeshMachine::TNodeActivity& name :: Self() {return iSelf;} \
EXPORT_C const NetStateMachine::TStateTriple& name :: FirstTriple() {return iData[1];} \
- const MeshMachine::TNodeActivity name :: iSelf = {id, 1, msgtype::EId, msgtype::ERealm, name :: iData[1], (TAny*)&ctor, NULL}; \
+ const MeshMachine::TNodeActivity name :: iSelf = {id, MeshMachine::TNodeActivity::EContextCtor, msgtype::EId, msgtype::ERealm, name :: iData[1], (TAny*)&ctor, NULL}; \
DEFINE_TRIPLES_TABLE( name :: iData )
/**
@@ -513,7 +513,7 @@
@see CNodeActivityBase
*/
#define DEFINE_RESERVED_CUSTOM_NODEACTIVITY( id, name, msgtype, ctor ) \
- const MeshMachine::TNodeActivity name :: iSelf = {id, 1, msgtype::EId, msgtype::ERealm, name :: iData[1], (TAny*)&ctor, NULL}; \
+ const MeshMachine::TNodeActivity name :: iSelf = {id, MeshMachine::TNodeActivity::EContextCtor, msgtype::EId, msgtype::ERealm, name :: iData[1], (TAny*)&ctor, NULL}; \
DEFINE_TRIPLES_TABLE( name :: iData )
#endif
@@ -928,7 +928,26 @@
All the nodes that have started the same activity
*/
RArray<Messages::XNodePeerId> iOriginators;
-
+/* class TOriginatorStore
+ {
+ private:
+ typedef Messages::XNodePeerId TOriginatorType;
+ public:
+ class Iterator
+ {
+ public:
+ Iterator(const TOriginatorStore& aOriginatorStore);
+ TOriginatorType* operator++();
+ operator*();
+ };
+ virtual TInt Count() const {return iOriginators.Count();}
+ virtual const TOriginatorType& operator[](TUint aIndex) const {return iOriginators[aIndex];};
+ virtual TInt Append(const Messages::RNodeInterface& aInterface);
+ virtual TInt Remove(const Messages::RNodeInterface& aInterface);
+ private:
+ RArray<TOriginatorType> iOriginators;
+ } iOriginators;
+*/
private: //Shouldn't be accessed directly
TInt iError; //Risk of failure is a generic property of an activity.
//Activities may choose to use external error handling activities,
@@ -1542,9 +1561,10 @@
// CPreallocatedNodeActivityBase
//
//-=========================================================
-template <TInt ORIGINATORSCOUNT>
+// APreallocatedOriginators is primed with 2 as the vast majority of Activities will have a maximum of 2 originators.
+// Corner cases should be handled seperately. For example CDestroyActivity has its own implementation as it will only ever have 1 originator
class CPreallocatedNodeRetryActivity : public MeshMachine::CNodeRetryActivity,
- protected MeshMachine::APreallocatedOriginators<ORIGINATORSCOUNT>
+ protected MeshMachine::APreallocatedOriginators<2>
/**
@internalTechnology
*/
@@ -1561,7 +1581,7 @@
protected:
CPreallocatedNodeRetryActivity(const MeshMachine::TNodeActivity& aActivitySig, MeshMachine::AMMNodeBase& aNode)
: CNodeRetryActivity(aActivitySig, aNode),
- APreallocatedOriginators<ORIGINATORSCOUNT>(iOriginators)
+ APreallocatedOriginators<2>(iOriginators)
{
}
@@ -1584,6 +1604,14 @@
return GetNextActivityCount(aActivitySig, aNode);
}
+//By default we reserve the space for preallocated activities generously, to fit even a synchronised activity preallocating space for up to 3 originators.
+//Any node, hosting specific activities that may need the preallocation mechanism can choose a more optimal amounts.
+//For efficiency reasons it is strongly recommended that any node (or family of nodes) is revisited and an optimal
+//amount of space is specified (could be specified in the base class for those nodes or in every type of node separatelly).
+static const TUint KDefaultMaxPreallocatedActivityCount = 3;
+static const TUint KDefaultMaxPreallocatedActivitySize = sizeof(CNodeRetryParallelActivity) + sizeof(APreallocatedOriginators<3>);
+static const TUint KDefaultPreallocatedActivityBufferSize = KDefaultMaxPreallocatedActivityCount * KDefaultMaxPreallocatedActivitySize;
+
} //namespace MeshMachine
#endif //SYMBIAN_MM_ACTIVITIES_H
--- a/commsfwsupport/commselements/meshmachine/inc/mm_activities_internal.h Tue Aug 03 15:29:29 2010 +0100
+++ b/commsfwsupport/commselements/meshmachine/inc/mm_activities_internal.h Tue Aug 24 14:43:02 2010 +0100
@@ -46,11 +46,6 @@
/**
*/
{
- enum TNodeActivityFlags
- {
- EContextCtor = 1
- };
-
/*There are now two types of activity c'tors (hence TAny iCtor supported:
(1) The legacy ctor based on AMMNodeBase that must be supported for source backwards compatibility
(2) The new ctor based on TNodeContextBase that is desired because TNodeContextBase gives access to AMMNodeBase as well as the message
@@ -58,6 +53,12 @@
by allowing access to the peer, which stores the space preallocated for the activity
Ideally this once fixed to only leave (2) especially since differentiating (1) from (2) is rather obscure. iCtor is a pointer
to a pointer to a ctor function and the distinction is based on where iCtor points (see AMMNodeBase::StartActivityL) */
+ enum TNodeActivityFlags
+ {
+ ENodeCtor = 0,
+ EContextCtor = 1
+ };
+
typedef CNodeActivityBase* (*TStaticActivityCtor)(const TNodeActivity& aActivitySig, AMMNodeBase& aNode);
typedef CNodeActivityBase* (*TStaticActivityContextCtor)(const TNodeActivity& aActivitySig, TNodeContextBase& aCtx);
const TUint8 iId;
--- a/commsfwsupport/commselements/meshmachine/src/mm_node.cpp Tue Aug 03 15:29:29 2010 +0100
+++ b/commsfwsupport/commselements/meshmachine/src/mm_node.cpp Tue Aug 24 14:43:02 2010 +0100
@@ -36,14 +36,6 @@
using namespace MeshMachine;
using namespace NetStateMachine;
-//By default we reserve the space generously, to fit even a synchronised activity preallocating space for up to 4 originators.
-//Any node, hosting specific activities that may need the preallocation mechanism can choose a more optimal amounts.
-//For efficiency reasons it is strongly recommended that any node (or family of nodes) is revisited and an optimal
-//amount of space is specified (could be specified in the base class for those nodes or in every type of node separatelly).
-static const TUint KDefaultMaxPreallocatedActivityCount = 1;
-static const TUint KMaxPreallocatedActivitySize = sizeof(CNodeRetryParallelActivity) + sizeof(APreallocatedOriginators<4>);
-static const TUint KDefaultPreallocatedActivityBufferSize = KDefaultMaxPreallocatedActivityCount * KMaxPreallocatedActivitySize;
-
//-=========================================================
//
//Panics
@@ -124,7 +116,7 @@
{
//Nodes will usually use the default parameter (-1) and rely on KDefaultPreallocatedActivityBufferSize.
//We do not use KDefaultPreallocatedActivityBufferSize as the default argument to avoid publishing of
- //this constant or KDefaultMaxPreallocatedActivityCount/KMaxPreallocatedActivitySize (either can be
+ //this constant or KDefaultMaxPreallocatedActivityCount/KDefaultMaxPreallocatedActivitySize (either can be
//freely changed at any time).
aSize = KDefaultPreallocatedActivityBufferSize;
}
@@ -675,7 +667,7 @@
// to ensure they can be added to the activities list while the system is out of memory. We also
// add enough space for extra data strucures to store the free list - the caller cannot reserve this
// space without knowledge of the preallocation implementation so we do this ourselves.
- TUint maxPreallocatedActivities = aSize / KMaxPreallocatedActivitySize;
+ TUint maxPreallocatedActivities = aSize / KDefaultMaxPreallocatedActivitySize;
iActivities.ReserveL(iActivities.Count() + maxPreallocatedActivities);
__ASSERT_DEBUG(iPreallocatedSpace==NULL, User::Panic(KSpecAssert_ElemMeshMachNodC, 5));
iPreallocatedSpace = User::AllocZL(aSize + sizeof(TUint) + maxPreallocatedActivities * sizeof(TAny*));
@@ -697,7 +689,7 @@
// Calculate the offset of the start of the preallocated space after the free list.
TUint8* bufferStart = reinterpret_cast<TUint8*>(iPreallocatedSpace) + sizeof(TUint*) + MaxPreallocatedActivityCount() * sizeof(TAny*);
- return bufferStart + aIndex * KMaxPreallocatedActivitySize;
+ return bufferStart + aIndex * KDefaultMaxPreallocatedActivitySize;
}
TAny* AMMNodeBase::BorrowPreallocatedSpace(TUint aSize)
@@ -705,16 +697,16 @@
MESH_LOG((KMeshMachineSubTag, _L8("AMMNodeBase %08x:\tBorrowPreallocatedSpace (%d)"),this,aSize));
__ASSERT_ALWAYS(iPreallocatedSpace, User::Panic(KMMNodePanic, EPanicPreallocatedSpaceAlreadyTaken));
- __ASSERT_ALWAYS(aSize <= KMaxPreallocatedActivitySize, User::Panic(KMMNodePanic, EPanicPreallocatedSpaceAlreadyTaken));
+ __ASSERT_ALWAYS(aSize <= KDefaultMaxPreallocatedActivitySize, User::Panic(KMMNodePanic, EPanicPreallocatedSpaceAlreadyTaken));
#ifdef SYMBIAN_TRACE_ENABLE
if(!iPreallocatedSpace)
{
MESH_LOG((KMeshMachineSubTag, _L8("ERROR AMMNodeBase %08x:\tBorrowPreallocatedSpace - Preallocated space has not been allocated!"), this));
}
- if(aSize>KMaxPreallocatedActivitySize)
+ if(aSize>KDefaultMaxPreallocatedActivitySize)
{
- MESH_LOG((KMeshMachineSubTag, _L8("ERROR AMMNodeBase %08x:\tBorrowPreallocatedSpace - Size exceeds maximum limit for a single allocation (%d was requested but only %d is available)!"), this, aSize, KMaxPreallocatedActivitySize));
+ MESH_LOG((KMeshMachineSubTag, _L8("ERROR AMMNodeBase %08x:\tBorrowPreallocatedSpace - Size exceeds maximum limit for a single allocation (%d was requested but only %d is available)!"), this, aSize, KDefaultMaxPreallocatedActivitySize));
}
#endif
@@ -732,7 +724,7 @@
ptr = freeList[index] = GetPreallocatedCell(index);
// Zero the cell so that any object allocated will have the expected initial zero fill.
- memset(ptr, 0, KMaxPreallocatedActivitySize);
+ memset(ptr, 0, KDefaultMaxPreallocatedActivitySize);
break;
}
--- a/datacommsserver/esockserver/CoreProviders/src/corecpr.cpp Tue Aug 03 15:29:29 2010 +0100
+++ b/datacommsserver/esockserver/CoreProviders/src/corecpr.cpp Tue Aug 24 14:43:02 2010 +0100
@@ -36,12 +36,6 @@
_LIT8(KCoreCprSubTag, "corecpr");
#endif
-//We reserve space for two preallocated activities that may start concurrently on the CPR
-//node: destroy and data client stop.
-static const TUint KDefaultMaxPreallocatedActivityCount = 2;
-static const TUint KMaxPreallocatedActivitySize = sizeof(MeshMachine::CNodeRetryParallelActivity) + sizeof(MeshMachine::APreallocatedOriginators<4>);
-static const TUint KCPRPreallocatedActivityBufferSize = KDefaultMaxPreallocatedActivityCount * KMaxPreallocatedActivitySize;
-
using namespace ESock;
using namespace NetStateMachine;
using namespace Messages;
@@ -59,7 +53,7 @@
{
CCoreConnectionProvider* provider = new (ELeave) CCoreConnectionProvider(aFactory,CprActivities::coreCprActivities::Self());
CleanupStack::PushL(provider);
- provider->ConstructL(KCPRPreallocatedActivityBufferSize);
+ provider->ConstructL();
CleanupStack::Pop(provider);
return provider;
}
--- a/datacommsserver/esockserver/CoreProviders/src/corescpr.cpp Tue Aug 03 15:29:29 2010 +0100
+++ b/datacommsserver/esockserver/CoreProviders/src/corescpr.cpp Tue Aug 24 14:43:02 2010 +0100
@@ -39,12 +39,6 @@
using namespace Messages;
using namespace MeshMachine;
-//We reserve space for two preallocated activities that may start concurrently on the SCPR
-//node: destroy and data client stop.
-static const TUint KSCPRDefaultMaxPreallocatedActivityCount = 2;
-static const TUint KMaxPreallocatedActivitySize = sizeof(MeshMachine::CNodeRetryParallelActivity) + sizeof(MeshMachine::APreallocatedOriginators<4>);
-static const TUint KSCPRPreallocatedActivityBufferSize = KSCPRDefaultMaxPreallocatedActivityCount * KMaxPreallocatedActivitySize;
-
EXPORT_C CCoreSubConnectionProvider::CCoreSubConnectionProvider(CSubConnectionProviderFactoryBase& aFactory,
const MeshMachine::TNodeActivityMap& aActivityMap)
:CSubConnectionProviderBase(aFactory,aActivityMap)
@@ -62,7 +56,7 @@
{
CCoreSubConnectionProvider* provider = new (ELeave) CCoreSubConnectionProvider(aFactory);
CleanupStack::PushL(provider);
- provider->ConstructL(KSCPRPreallocatedActivityBufferSize);
+ provider->ConstructL();
CleanupStack::Pop();
return provider;
}
--- a/datacommsserver/esockserver/MobilityCoreProviders/src/mobilitycpr.cpp Tue Aug 03 15:29:29 2010 +0100
+++ b/datacommsserver/esockserver/MobilityCoreProviders/src/mobilitycpr.cpp Tue Aug 24 14:43:02 2010 +0100
@@ -46,12 +46,6 @@
using namespace Messages;
using namespace MeshMachine;
-//We reserve space for two preallocated activities that may start concurrently on the CPR
-//node: destroy and data client stop.
-static const TUint KMobilityCPRDefaultMaxPreallocatedActivityCount = 2;
-static const TUint KMaxPreallocatedActivitySize = sizeof(MeshMachine::CNodeRetryParallelActivity) + sizeof(MeshMachine::APreallocatedOriginators<4>);
-static const TUint KMobilityCPRPreallocatedActivityBufferSize = KMobilityCPRDefaultMaxPreallocatedActivityCount * KMaxPreallocatedActivitySize;
-
//-=========================================================
//
// CMobilityConnectionProvider methods
@@ -61,7 +55,7 @@
{
CMobilityConnectionProvider* provider = new (ELeave) CMobilityConnectionProvider(aFactory, aActivityMap);
CleanupStack::PushL(provider);
- provider->ConstructL(KMobilityCPRPreallocatedActivityBufferSize);
+ provider->ConstructL();
CleanupStack::Pop(provider);
return provider;
}
--- a/datacommsserver/esockserver/bwins/esocksvrU.DEF Tue Aug 03 15:29:29 2010 +0100
+++ b/datacommsserver/esockserver/bwins/esocksvrU.DEF Tue Aug 24 14:43:02 2010 +0100
@@ -1054,4 +1054,5 @@
?Match@TTierTypeIdFactoryQuery@ESock@@MAE?AW4TMatchResult@MFactoryQuery@Factories@@AAUTFactoryObjectInfo@5@@Z @ 1053 NONAME ; enum Factories::MFactoryQuery::TMatchResult ESock::TTierTypeIdFactoryQuery::Match(struct Factories::TFactoryObjectInfo &)
?GetVDataTableStatic@TTierTypeIdFactoryQuery@ESock@@SAPBUSVDataTableEntry@Meta@@XZ @ 1054 NONAME ; struct Meta::SVDataTableEntry const * ESock::TTierTypeIdFactoryQuery::GetVDataTableStatic(void)
?AddClientL@CMMCommsProviderBase@ESock@@UAEPAVRNodeInterface@Messages@@ABVTNodeId@4@ABVTClientType@4@PAX@Z @ 1055 NONAME ; class Messages::RNodeInterface * ESock::CMMCommsProviderBase::AddClientL(class Messages::TNodeId const &, class Messages::TClientType const &, void *)
+ ?ConstructL@ACFMMNodeBase@ESock@@IAEXH@Z @ 1056 NONAME ; void ESock::ACFMMNodeBase::ConstructL(int)
--- a/datacommsserver/esockserver/core_states/ss_corepractivities.cpp Tue Aug 03 15:29:29 2010 +0100
+++ b/datacommsserver/esockserver/core_states/ss_corepractivities.cpp Tue Aug 24 14:43:02 2010 +0100
@@ -326,7 +326,7 @@
namespace PRDataClientStopActivity
{
-DECLARE_DEFINE_CUSTOM_NODEACTIVITY(ECFActivityStopDataClient, PRDataClientStop, TCFDataClient::TStop, MeshMachine::CNodeRetryActivity::NewL)
+DECLARE_DEFINE_CUSTOM_NODEACTIVITY(ECFActivityStopDataClient, PRDataClientStop, TCFDataClient::TStop, MeshMachine::CPreallocatedNodeRetryActivity::New)
FIRST_NODEACTIVITY_ENTRY(CoreNetStates::TAwaitingDataClientStop, MeshMachine::TNoTag)
THROUGH_NODEACTIVITY_ENTRY(KNoTag, PRStates::TProcessDataClientStop, CoreNetStates::TNoTagOrDataClientsToStopBlockedByStarting)
@@ -358,7 +358,7 @@
namespace PRGoneDownActivity
{
-DECLARE_DEFINE_CUSTOM_NODEACTIVITY(ECFActivityGoneDown, PRGoneDown, TCFControlClient::TGoneDown, CGoneDownActivity::NewL)
+DECLARE_DEFINE_CUSTOM_NODEACTIVITY(ECFActivityGoneDown, PRGoneDown, TCFControlClient::TGoneDown, CGoneDownActivity::New)
// Our Service Provider has gone down unexpectedly (we haven't issued a TStop)
FIRST_NODEACTIVITY_ENTRY(CoreNetStates::TAwaitingGoneDown, MeshMachine::TNoTag)
THROUGH_NODEACTIVITY_ENTRY(KNoTag, CoreNetStates::TCancelAndCloseZone0ClientExtIfaces, MeshMachine::TNoTag)
@@ -2117,16 +2117,26 @@
//Gone Down Activity
//
//-=========================================================
-MeshMachine::CNodeActivityBase* CGoneDownActivity::NewL(const MeshMachine::TNodeActivity& aActivitySig, MeshMachine::AMMNodeBase& aNode)
- {
- CGoneDownActivity* self = new (ELeave) CGoneDownActivity(aActivitySig,aNode);
- return self;
- }
+
+MeshMachine::CNodeActivityBase* CGoneDownActivity::New(const MeshMachine::TNodeActivity& aActivitySig, MeshMachine::AMMNodeBase& aNode)
+ {
+ TAny* space = BorrowPreallocatedSpace(aNode, sizeof(CGoneDownActivity));
+ CGoneDownActivity* self = new (space) CGoneDownActivity(aActivitySig, aNode);
+ self->AppendPreallocatedActivity();
+ return self;
+ }
CGoneDownActivity::CGoneDownActivity(const MeshMachine::TNodeActivity& aActivitySig, MeshMachine::AMMNodeBase& aNode)
-: MeshMachine::CNodeRetryActivity(aActivitySig, aNode)
- {
- }
+ : CNodeRetryActivity(aActivitySig, aNode),
+ APreallocatedOriginators<2>(iOriginators)
+ {
+ }
+
+void CGoneDownActivity::Destroy()
+ {
+ this->~CGoneDownActivity(); //Run the destructor
+ ReturnPreallocatedSpace(this);
+ }
CGoneDownActivity::~CGoneDownActivity()
{
@@ -2212,7 +2222,42 @@
return CoreStates::KPropagate | NetStateMachine::EForward;
}
+//-=========================================================
+//
+//Stop Activity
+//
+//-=========================================================
+/*
+MeshMachine::CNodeActivityBase* CStopActivity::New(const MeshMachine::TNodeActivity& aActivitySig, MeshMachine::AMMNodeBase& aNode)
+ {
+ TAny* space = BorrowPreallocatedSpace(aNode, sizeof(CStopActivity));
+ CStopActivity* self = new (space) CStopActivity(aActivitySig, aNode);
+ self->AppendPreallocatedActivity();
+ return self;
+ }
+CStopActivity::CStopActivity(const MeshMachine::TNodeActivity& aActivitySig, MeshMachine::AMMNodeBase& aNode)
+ : CNodeRetryActivity(aActivitySig, aNode),
+ APreallocatedOriginators<10>(iOriginators)
+ {
+ }
+
+void CStopActivity::Destroy()
+ {
+ this->~CStopActivity(); //Run the destructor
+ ReturnPreallocatedSpace(this);
+ }
+
+CStopActivity::~CStopActivity()
+ {
+ //This is a gone down activity. Error mode is its only/natural state
+ //CGoneDownActivity inherits ultimatelly from CNodeActivityBase, which
+ //will attempt to interpret the error mode as a failure to execute (and
+ //auto respond to orignators), which we don't want. Hence clearing
+ //the error and allowing 'this' to die peacefully.
+ SetError(KErrNone);
+ }
+*/
EXPORT_DEFINE_SMELEMENT(CStartActivity::TAwaitingBindToCompleteOrCancel, NetStateMachine::MState, CStartActivity::TContext)
TBool CStartActivity::TAwaitingBindToCompleteOrCancel::Accept()
{
--- a/datacommsserver/esockserver/core_states/ss_corepractivities.h Tue Aug 03 15:29:29 2010 +0100
+++ b/datacommsserver/esockserver/core_states/ss_corepractivities.h Tue Aug 24 14:43:02 2010 +0100
@@ -888,17 +888,24 @@
//
//-=========================================================
-class CGoneDownActivity : public MeshMachine::CNodeRetryActivity
+class CGoneDownActivity : public MeshMachine::CNodeRetryActivity, protected MeshMachine::APreallocatedOriginators<2>
{
public:
- static MeshMachine::CNodeActivityBase* NewL(const MeshMachine::TNodeActivity& aActivitySig, MeshMachine::AMMNodeBase& aNode);
+ static MeshMachine::CNodeActivityBase* New(const MeshMachine::TNodeActivity& aActivitySig, MeshMachine::AMMNodeBase& aNode);
protected:
CGoneDownActivity(const MeshMachine::TNodeActivity& aActivitySig, MeshMachine::AMMNodeBase& aNode);
virtual TBool IsIdle() const;
virtual void StartL(MeshMachine::TNodeContextBase& aContext, const Messages::XNodePeerId& aOriginator, const NetStateMachine::TStateTriple& aFirst);
virtual ~CGoneDownActivity();
-
+ virtual void Destroy();
+
+private:
+ /*
+ Private NewL with no implementation to hide the CNodeActivityBase::NewL
+ Creation of preallocated activities doesn't fail and hence a non-leaving ::New should be used instead*/
+ static MeshMachine::CNodeActivityBase* NewL(const MeshMachine::TNodeActivity& aActivitySig, MeshMachine::AMMNodeBase& aNode);
+
public:
TUint iGoneDownApId;
@@ -915,6 +922,34 @@
DECLARE_SMELEMENT_FOOTER( TSendErrorRecoveryReq )
};
+//-=========================================================
+//
+//Stop Activity
+//
+//-=========================================================
+/*
+class CStopActivity : public MeshMachine::CNodeRetryActivity
+ {
+ static const TUint KPreallocatedStopActivitySize = sizeof(CStopActivity) + sizeof(MeshMachine::APreallocatedOriginators<10>);
+public:
+ static MeshMachine::CNodeActivityBase* New(const MeshMachine::TNodeActivity& aActivitySig, MeshMachine::AMMNodeBase& aNode);
+protected:
+ CStopActivity(const MeshMachine::TNodeActivity& aActivitySig, MeshMachine::AMMNodeBase& aNode);
+ virtual ~CStopActivity();
+ virtual void Destroy();
+private:
+*/
+ /*
+ Private NewL with no implementation to hide the CNodeActivityBase::NewL
+ Creation of preallocated activities doesn't fail and hence a non-leaving ::New should be used instead
+ */
+
+/*
+static MeshMachine::CNodeActivityBase* NewL(const MeshMachine::TNodeActivity& aActivitySig, MeshMachine::AMMNodeBase& aNode);
+
+ };
+*/
+
} //namespace PRActivities
--- a/datacommsserver/esockserver/eabi/esocksvrU.DEF Tue Aug 03 15:29:29 2010 +0100
+++ b/datacommsserver/esockserver/eabi/esocksvrU.DEF Tue Aug 24 14:43:02 2010 +0100
@@ -1961,4 +1961,5 @@
_ZThn4_N5ESock23TTierTypeIdFactoryQuery5MatchERN9Factories18TFactoryObjectInfoE @ 1960 NONAME
_ZN5ESock20CMMCommsProviderBase10AddClientLERKN8Messages7TNodeIdERKNS1_11TClientTypeEPv @ 1961 NONAME
_ZThn36_N5ESock20CMMCommsProviderBase10AddClientLERKN8Messages7TNodeIdERKNS1_11TClientTypeEPv @ 1962 NONAME
+ _ZN5ESock13ACFMMNodeBase10ConstructLEi @ 1963 NONAME
--- a/datacommsserver/esockserver/inc/ss_mmnode.h Tue Aug 03 15:29:29 2010 +0100
+++ b/datacommsserver/esockserver/inc/ss_mmnode.h Tue Aug 24 14:43:02 2010 +0100
@@ -49,6 +49,8 @@
{
}
+ IMPORT_C void ConstructL(TInt aSize = MeshMachine::KUseDefaultPreallocatedSize); //When KUseDefaultPreallocatedSize, KDefaultMaxPreallocatedActivitySize will be used
+
/**
Fetch the interface control for a given interface id
@param aInterfaceId Interface id to fetch control for.
--- a/datacommsserver/esockserver/ssock/ss_conn.cpp Tue Aug 03 15:29:29 2010 +0100
+++ b/datacommsserver/esockserver/ssock/ss_conn.cpp Tue Aug 24 14:43:02 2010 +0100
@@ -71,12 +71,6 @@
using namespace MeshMachine;
using namespace Den;
-//We reserve space for two preallocated activities that may start concurrently on the connection
-//node: destroy (connection close) and connection stop.
-static const TUint KDefaultMaxPreallocatedActivityCount = 2;
-static const TUint KMaxPreallocatedActivitySize = sizeof(CNodeRetryParallelActivity) + sizeof(APreallocatedOriginators<4>);
-static const TUint KConnectionPreallocatedActivityBufferSize = KDefaultMaxPreallocatedActivityCount * KMaxPreallocatedActivitySize;
-
//
//Activities serving client (RConnection) requests
namespace ConnectionStartActivity
@@ -312,7 +306,7 @@
namespace ConnectionGoingDownActivity
{
-DECLARE_DEFINE_CUSTOM_NODEACTIVITY(ECFActivityGoneDown, ConnectionGoingDown, TCFControlClient::TGoneDown, PRActivities::CGoneDownActivity::NewL)
+DECLARE_DEFINE_CUSTOM_NODEACTIVITY(ECFActivityGoneDown, ConnectionGoingDown, TCFControlClient::TGoneDown, PRActivities::CGoneDownActivity::New)
FIRST_NODEACTIVITY_ENTRY(ConnStates::TAwaitingGoneDown, MeshMachine::TNoTag)
THROUGH_NODEACTIVITY_ENTRY(KNoTag, ConnectionGoingDownActivity::TStoreGoneDownError, MeshMachine::TNoTag)
THROUGH_NODEACTIVITY_ENTRY(KNoTag, SubSessStates::TCancelAndCloseClientExtIfaces, MeshMachine::TNoTag)
@@ -514,7 +508,7 @@
void CConnection::ConstructL()
{
- MeshMachine::AMMNodeBase::ConstructL(KConnectionPreallocatedActivityBufferSize);
+ MeshMachine::AMMNodeBase::ConstructL();
CSockSubSession::ConstructL(NULL);
iConnectionInfo = CConnectionInfo::NewL(UniqueId());
--- a/datacommsserver/esockserver/ssock/ss_mmcommsprov.cpp Tue Aug 03 15:29:29 2010 +0100
+++ b/datacommsserver/esockserver/ssock/ss_mmcommsprov.cpp Tue Aug 24 14:43:02 2010 +0100
@@ -33,10 +33,6 @@
using namespace ESock;
using namespace Messages;
-//We reserve space for two preallocated activities that may start concurrently on the connection
-//node: destroy (connection close) and connection stop.
-static const TUint KMaxPreallocatedActivitySize = sizeof(MeshMachine::CNodeRetryParallelActivity) + sizeof(MeshMachine::APreallocatedOriginators<4>);
-
CMMCommsProviderBase::CMMCommsProviderBase(CCommsFactoryBase& aFactory,
const MeshMachine::TNodeActivityMap& aActivityMap)
: ACommsFactoryNodeId(aFactory),
@@ -123,7 +119,7 @@
if(aClientType.Type() == TCFClientType::ECtrl)
{
- TRAPD(err, nodeInterface->PreAllocL(KMaxPreallocatedActivitySize));
+ TRAPD(err, nodeInterface->PreAllocL(MeshMachine::KDefaultMaxPreallocatedActivitySize));
if(err!=KErrNone)
{
RemoveClient(nodeInterface->RecipientId());
--- a/datacommsserver/esockserver/ssock/ss_mmnode.cpp Tue Aug 03 15:29:29 2010 +0100
+++ b/datacommsserver/esockserver/ssock/ss_mmnode.cpp Tue Aug 24 14:43:02 2010 +0100
@@ -19,12 +19,26 @@
#include <comms-infras/ss_log.h>
#include <comms-infras/ss_mmnode.h>
+#include <comms-infras/ss_corepractivities.h>
using namespace NetStateMachine;
using namespace Messages;
using namespace MeshMachine;
using namespace ESock;
+EXPORT_C void ACFMMNodeBase::ConstructL(TInt aSize)
+ {
+ //Preallocate space for preallocated activities
+ if (aSize==KUseDefaultPreallocatedSize)
+ {
+ //Nodes will usually use the default parameter (-1) and rely on KDefaultPreallocatedActivityBufferSize.
+ //We do not use KDefaultPreallocatedActivityBufferSize as the default argument to avoid publishing of
+ //this constant or KDefaultMaxPreallocatedActivityCount/KDefaultMaxPreallocatedActivitySize (either can be
+ //freely changed at any time).
+ aSize = KDefaultMaxPreallocatedActivityCount * KDefaultMaxPreallocatedActivitySize;
+ }
+ AMMNodeBase::ConstructL(aSize);
+ }
EXPORT_C void ACFMMNodeBase::HandlePassThroughMessage(TNodeContextBase& aContext)
{
--- a/datacommsserver/esockserver/test/providers/dummy/src/dummypr_connprov.cpp Tue Aug 03 15:29:29 2010 +0100
+++ b/datacommsserver/esockserver/test/providers/dummy/src/dummypr_connprov.cpp Tue Aug 24 14:43:02 2010 +0100
@@ -47,11 +47,6 @@
using namespace MeshMachine;
using namespace PRActivities;
-//We reserve space for two preallocated activities that may start concurrently on the CPR
-//node: destroy and data client stop.
-static const TUint KDefaultMaxPreallocatedActivityCount = 2;
-static const TUint KMaxPreallocatedActivitySize = sizeof(MeshMachine::CNodeRetryParallelActivity) + sizeof(MeshMachine::APreallocatedOriginators<4>);
-static const TUint KDummyCPRPreallocatedActivityBufferSize = KDefaultMaxPreallocatedActivityCount * KMaxPreallocatedActivitySize;
static const TUint KDestroyDelay = 3000;
//-================================================
//
@@ -251,7 +246,7 @@
{
CDummyConnectionProvider* self = new (ELeave) CDummyConnectionProvider(aFactory, DummyCPRStates::stateMap::Self(), aConnStatus);
CleanupStack::PushL(self);
- self->ConstructL(KDummyCPRPreallocatedActivityBufferSize);
+ self->ConstructL();
CleanupStack::Pop(self);
return self;
}
@@ -260,7 +255,7 @@
{
CDummyConnectionProvider* self = new (ELeave) CDummyConnectionProvider(aFactory, VanillaDummyCPRStates::stateMap::Self(), CDummyConnectionProvider::EConnNoIncoming);
CleanupStack::PushL(self);
- self->ConstructL(KDummyCPRPreallocatedActivityBufferSize);
+ self->ConstructL();
CleanupStack::Pop(self);
return self;
}
--- a/datacommsserver/esockserver/test/providers/dummy/src/dummypr_extended_subconnprov.cpp Tue Aug 03 15:29:29 2010 +0100
+++ b/datacommsserver/esockserver/test/providers/dummy/src/dummypr_extended_subconnprov.cpp Tue Aug 24 14:43:02 2010 +0100
@@ -67,12 +67,6 @@
using namespace Messages;
using namespace MeshMachine;
-//We reserve space for two preallocated activities that may start concurrently on the extended SCPR
-//node: destroy and data client stop.
-static const TUint KDefaultMaxPreallocatedActivityCount = 2;
-static const TUint KMaxPreallocatedActivitySize = sizeof(MeshMachine::CNodeRetryParallelActivity) + sizeof(MeshMachine::APreallocatedOriginators<4>);
-static const TUint KDummyExtendedSCPRPreallocatedActivityBufferSize = KDefaultMaxPreallocatedActivityCount * KMaxPreallocatedActivitySize;
-
namespace DummyExtendedSCPRStates
{
DEFINE_SMELEMENT(TAwaitingBinderResponse, NetStateMachine::MState, DummyExtendedSCPRStates::TContext)
@@ -376,7 +370,7 @@
void CDummyExtendedSubConnectionProvider::ConstructL()
{
- CCoreSubConnectionProvider::ConstructL(KDummyExtendedSCPRPreallocatedActivityBufferSize);
+ CCoreSubConnectionProvider::ConstructL();
}
CDummyExtendedSubConnectionProvider::CDummyExtendedSubConnectionProvider(CSubConnectionProviderFactoryBase& aFactory)
--- a/datacommsserver/esockserver/test/providers/dummy/src/dummypr_subconnprov.cpp Tue Aug 03 15:29:29 2010 +0100
+++ b/datacommsserver/esockserver/test/providers/dummy/src/dummypr_subconnprov.cpp Tue Aug 24 14:43:02 2010 +0100
@@ -38,12 +38,6 @@
using namespace ESock;
using namespace MeshMachine;
-//We reserve space for two preallocated activities that may start concurrently on the SCPR
-//node: destroy and data client stop.
-static const TUint KDefaultMaxPreallocatedActivityCount = 2;
-static const TUint KMaxPreallocatedActivitySize = sizeof(MeshMachine::CNodeRetryParallelActivity) + sizeof(MeshMachine::APreallocatedOriginators<4>);
-static const TUint KDummySCPRPreallocatedActivityBufferSize = KDefaultMaxPreallocatedActivityCount * KMaxPreallocatedActivitySize;
-
namespace DummySCPRStates
{
DEFINE_SMELEMENT(TRaiseGranted, NetStateMachine::MStateTransition, DummySCPRStates::TContext)
@@ -231,7 +225,7 @@
{
CDummySubConnectionProvider* self = new (ELeave) CDummySubConnectionProvider(aFactory, DummySCPRStates::stateMap::Self());
CleanupStack::PushL(self);
- self->ConstructL(KDummySCPRPreallocatedActivityBufferSize);
+ self->ConstructL();
CleanupStack::Pop(self);
return self;
}
@@ -240,7 +234,7 @@
{
CDummySubConnectionProvider* self = new (ELeave) CDummySubConnectionProvider(aFactory, VanillaDummySCPRStates::stateMap::Self());
CleanupStack::PushL(self);
- self->ConstructL(KDummySCPRPreallocatedActivityBufferSize);
+ self->ConstructL();
CleanupStack::Pop(self);
return self;
}