201019_01
authorhgs
Fri, 14 May 2010 14:12:43 +0100
changeset 30 df67dc5d759e
parent 25 e53adc4c49de
child 31 f5b12b673c07
201019_01
commsfwsupport/commselements/ResponseMsg/src/ResponseMsg.cpp
commsfwsupport/commselements/meshmachine/bwins/meshmachineu.def
commsfwsupport/commselements/meshmachine/eabi/meshmachineu.def
commsfwsupport/commselements/meshmachine/inc/mm_activities.h
commsfwsupport/commselements/meshmachine/inc/mm_activities_internal.h
commsfwsupport/commselements/meshmachine/src/mm_activities.cpp
commsfwsupport/commselements/meshmachine/src/mm_node.cpp
commsfwsupport/commselements/nodemessages/bwins/nodemessagesu.def
commsfwsupport/commselements/nodemessages/eabi/nodemessagesu.def
commsfwsupport/commselements/nodemessages/inc/nm_interfaces.h
commsfwsupport/commselements/nodemessages/inc/nm_node.h
commsfwsupport/commselements/nodemessages/src/nm_interfaces.cpp
datacommsserver/esockserver/CoreProviders/bwins/coreprovidersU.DEF
datacommsserver/esockserver/CoreProviders/eabi/coreprovidersU.DEF
datacommsserver/esockserver/CoreProviders/inc/corecpractivities.h
datacommsserver/esockserver/CoreProviders/src/corecpractivities.cpp
datacommsserver/esockserver/CoreProviders/src/corescpr.cpp
datacommsserver/esockserver/MobilityCoreProviders/eabi/mobilitycoreprovidersu.def
datacommsserver/esockserver/MobilityCoreProviders/src/mobilitycpr.cpp
datacommsserver/esockserver/MobilityCoreProviders/src/mobilitycpractivities.cpp
datacommsserver/esockserver/bwins/esocksvrU.DEF
datacommsserver/esockserver/core_states/ss_corepractivities.cpp
datacommsserver/esockserver/core_states/ss_corepractivities.h
datacommsserver/esockserver/core_states/ss_coreprstates.cpp
datacommsserver/esockserver/eabi/esocksvrU.DEF
datacommsserver/esockserver/inc/ss_mmcommsprov.h
datacommsserver/esockserver/ssock/ss_conn.cpp
datacommsserver/esockserver/ssock/ss_mmcommsprov.cpp
datacommsserver/esockserver/ssock/ss_sapshim.cpp
datacommsserver/esockserver/test/TE_DummyProvider/configs/te_dummyprovider_006.ini
datacommsserver/esockserver/test/TE_DummyProvider/configs/te_dummyproviders.cfg
datacommsserver/esockserver/test/TE_DummyProvider/group/TE_DummyProvider.iby
datacommsserver/esockserver/test/TE_DummyProvider/group/bld.inf
datacommsserver/esockserver/test/TE_DummyProvider/scripts/te_dummyprovider.script
datacommsserver/esockserver/test/TE_DummyProvider/scripts/te_dummyprovider_006.script
datacommsserver/esockserver/test/TE_EsockTestSteps/src/Connections.TestSteps.cpp
datacommsserver/esockserver/test/TE_EsockTestSteps/src/EsockTestBase.cpp
datacommsserver/esockserver/test/TE_RConnection/configs/Mobility/Mobility_760640.ini
datacommsserver/esockserver/test/TE_RConnection/scripts/Mobility/Mobility_760640.script
datacommsserver/esockserver/test/providers/dummy/group/dummypr.mmp
datacommsserver/esockserver/test/providers/dummy/inc/activityTest.h
datacommsserver/esockserver/test/providers/dummy/inc/dummypr_connprov.h
datacommsserver/esockserver/test/providers/dummy/inc/dummypr_factory.h
datacommsserver/esockserver/test/providers/dummy/inc/dummypr_subconnprov.h
datacommsserver/esockserver/test/providers/dummy/src/1028302A.rss
datacommsserver/esockserver/test/providers/dummy/src/activityTest.cpp
datacommsserver/esockserver/test/providers/dummy/src/dummypr_connprov.cpp
datacommsserver/esockserver/test/providers/dummy/src/dummypr_factory.cpp
datacommsserver/esockserver/test/providers/dummy/src/dummypr_subconnprov.cpp
--- a/commsfwsupport/commselements/ResponseMsg/src/ResponseMsg.cpp	Mon May 03 13:39:24 2010 +0300
+++ b/commsfwsupport/commselements/ResponseMsg/src/ResponseMsg.cpp	Fri May 14 14:12:43 2010 +0100
@@ -170,6 +170,10 @@
 	  		//That would usually be the fault of the client's CExtItfMsgPluginInfo.
 	  		//Depending on the state the client will be errored or panicked.
   			__DEBUGGER(); //diagnostic
+
+			// Mark the client buffer as read so that client can clean up gracefully
+			RMessage2::Write(iRequestMsgParam, KNullDesC8);
+
   			return NULL;
   			}
   		}
--- a/commsfwsupport/commselements/meshmachine/bwins/meshmachineu.def	Mon May 03 13:39:24 2010 +0300
+++ b/commsfwsupport/commselements/meshmachine/bwins/meshmachineu.def	Fri May 14 14:12:43 2010 +0100
@@ -45,7 +45,7 @@
 	?FindOriginator@CNodeActivityBase@MeshMachine@@QBEHABVTRuntimeCtxId@Messages@@@Z @ 44 NONAME ; int MeshMachine::CNodeActivityBase::FindOriginator(class Messages::TRuntimeCtxId const &) const
 	?FindOriginator@CNodeActivityBase@MeshMachine@@QBEHABVTNodePeerId@Messages@@@Z @ 45 NONAME ; int MeshMachine::CNodeActivityBase::FindOriginator(class Messages::TNodePeerId const &) const
 	?FindOriginator@CNodeActivityBase@MeshMachine@@QBEHABVRNodeInterface@Messages@@@Z @ 46 NONAME ; int MeshMachine::CNodeActivityBase::FindOriginator(class Messages::RNodeInterface const &) const
-	?GetNextActivityCountL@CNodeParallelActivityBase@MeshMachine@@KAIABUTNodeActivity@2@ABVAMMNodeBase@2@@Z @ 47 NONAME ; unsigned int MeshMachine::CNodeParallelActivityBase::GetNextActivityCountL(struct MeshMachine::TNodeActivity const &, class MeshMachine::AMMNodeBase const &)
+	?GetNextActivityCount@CNodeParallelActivityBase@MeshMachine@@KAIABUTNodeActivity@2@ABVAMMNodeBase@2@@Z @ 47 NONAME ; unsigned int MeshMachine::CNodeParallelActivityBase::GetNextActivityCount(struct MeshMachine::TNodeActivity const &, class MeshMachine::AMMNodeBase const &)
 	?GetVTablePtr@TAwaitingAny@MeshMachine@@SAPAVMState@NetStateMachine@@AAVTDesC8@@PAX@Z @ 48 NONAME ; class NetStateMachine::MState * MeshMachine::TAwaitingAny::GetVTablePtr(class TDesC8 &, void *)
 	?GetVTablePtr@TAwaitingCancel@MeshMachine@@SAPAVMState@NetStateMachine@@AAVTDesC8@@PAX@Z @ 49 NONAME ; class NetStateMachine::MState * MeshMachine::TAwaitingCancel::GetVTablePtr(class TDesC8 &, void *)
 	?GetVTablePtr@TAwaitingClientLeavingRequest@MeshMachine@@SAPAVMState@NetStateMachine@@AAVTDesC8@@PAX@Z @ 50 NONAME ; class NetStateMachine::MState * MeshMachine::TAwaitingClientLeavingRequest::GetVTablePtr(class TDesC8 &, void *)
@@ -136,4 +136,3 @@
 	??0CNodeParallelMessageStoreActivityBase@MeshMachine@@IAE@ABUTNodeActivity@1@AAVAMMNodeBase@1@I@Z @ 135 NONAME ; MeshMachine::CNodeParallelMessageStoreActivityBase::CNodeParallelMessageStoreActivityBase(struct MeshMachine::TNodeActivity const &, class MeshMachine::AMMNodeBase &, unsigned int)
 	?StartL@CNodeParallelMessageStoreActivityBase@MeshMachine@@MAEXAAVTNodeContextBase@2@ABVXNodePeerId@Messages@@ABUTStateTriple@NetStateMachine@@@Z @ 136 NONAME ; void MeshMachine::CNodeParallelMessageStoreActivityBase::StartL(class MeshMachine::TNodeContextBase &, class Messages::XNodePeerId const &, struct NetStateMachine::TStateTriple const &)
 
-
--- a/commsfwsupport/commselements/meshmachine/eabi/meshmachineu.def	Mon May 03 13:39:24 2010 +0300
+++ b/commsfwsupport/commselements/meshmachine/eabi/meshmachineu.def	Fri May 14 14:12:43 2010 +0100
@@ -81,7 +81,7 @@
 	_ZN11MeshMachine19TRaiseActivityError3DoLEv @ 80 NONAME
 	_ZN11MeshMachine22TAwaitingLeaveComplete12GetVTablePtrER6TDesC8Pv @ 81 NONAME
 	_ZN11MeshMachine22TAwaitingLeaveComplete6AcceptEv @ 82 NONAME
-	_ZN11MeshMachine25CNodeParallelActivityBase21GetNextActivityCountLERKNS_13TNodeActivityERKNS_11AMMNodeBaseE @ 83 NONAME
+	_ZN11MeshMachine25CNodeParallelActivityBase20GetNextActivityCountERKNS_13TNodeActivityERKNS_11AMMNodeBaseE @ 83 NONAME
 	_ZN11MeshMachine25CNodeParallelActivityBase4NewLERKNS_13TNodeActivityERNS_11AMMNodeBaseE @ 84 NONAME
 	_ZN11MeshMachine25CNodeParallelActivityBaseC1ERKNS_13TNodeActivityERNS_11AMMNodeBaseEj @ 85 NONAME
 	_ZN11MeshMachine25CNodeParallelActivityBaseC2ERKNS_13TNodeActivityERNS_11AMMNodeBaseEj @ 86 NONAME
@@ -204,4 +204,3 @@
 	_ZTVN11MeshMachine37CNodeParallelMessageStoreActivityBaseE @ 203 NONAME
 	_ZN11MeshMachine37CNodeParallelMessageStoreActivityBase6StartLERNS_16TNodeContextBaseERKN8Messages11XNodePeerIdERKN15NetStateMachine12TStateTripleE @ 204 NONAME
 
-
--- a/commsfwsupport/commselements/meshmachine/inc/mm_activities.h	Mon May 03 13:39:24 2010 +0300
+++ b/commsfwsupport/commselements/meshmachine/inc/mm_activities.h	Fri May 14 14:12:43 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, msgtype::EId, msgtype::ERealm, name :: iData[1], &ctor, _S8(#name)}; \
+		const MeshMachine::TNodeActivity name :: iSelf = {id, 0, 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, msgtype::EId, msgtype::ERealm, name :: iData[1], &ctor, _S8(#name)}; \
+		const MeshMachine::TNodeActivity name :: iSelf = {id, 0, 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, msgtype::EId, msgtype::ERealm, name :: iData[1], &ctor, NULL}; \
+		const MeshMachine::TNodeActivity name :: iSelf = {id, 0, 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, msgtype::EId, msgtype::ERealm, name :: iData[1], &ctor, NULL}; \
+		const MeshMachine::TNodeActivity name :: iSelf = {id, 0, msgtype::EId, msgtype::ERealm, name :: iData[1], (TAny*)&ctor, NULL}; \
 		DEFINE_TRIPLES_TABLE( name :: iData )
 
 #endif
@@ -417,6 +417,126 @@
 	};
 
 /**
+RESERVED MACROS NOT TO BE USED.
+The following are new macro definitions allowing the context to be passed as a parameter rather than the node.
+In time the ability to pass context rather than node will be placed in the original macros. For the meantime,
+only critical commsFw activities which must have the context passed instead of the node should use these macros.
+All other activities should continue to use original macros declared above.
+*/
+/**
+Declare and export a node activity.
+
+@param name  The name of the activity, which will be used to put it into the node's activity map
+
+@see DECLARE_NODEACTIVITY
+*/
+#define DECLARE_RESERVED_EXPORT_NODEACTIVITY( name ) \
+	struct name \
+		{ \
+		IMPORT_C static const MeshMachine::TNodeActivity& Self(); \
+		IMPORT_C static const NetStateMachine::TStateTriple& FirstTriple(); \
+		static const MeshMachine::TNodeActivity iSelf; \
+		static const NetStateMachine::TStateTriple iData[]; \
+		};
+
+/**
+Declares a node activity. A node activity is a state machine. It contains multiple nodeactivity
+entries, which respresent the states, transitions and forks of the state machine.
+
+@param name  The name of the activity, which will be used to put it into the node's activity map
+
+@see DEFINE_NODEACTIVITY
+@see NODEACTIVITY_ENTRY
+*/
+#define DECLARE_RESERVED_NODEACTIVITY( name ) \
+	struct name \
+		{ \
+		inline static const MeshMachine::TNodeActivity& Self() {return iSelf;} \
+		inline static const NetStateMachine::TStateTriple& FirstTriple() {return iData[1];} \
+		static const MeshMachine::TNodeActivity iSelf; \
+		static const NetStateMachine::TStateTriple iData[]; \
+		};
+
+#ifdef SYMBIAN_TRACE_ENABLE
+
+/**
+Define a custom node activity. A custom node activity is a node activity which defines its own
+node activity class. This is used, for example, if the activity wishes to share some custom context
+information between the states and transition in the activity.
+
+Node activity class must derive from CNodeActivityBase.
+
+@param id        Identifier for the activity
+@param name      The name of the activity
+@param msgtype   Message which will kickoff this activity
+@param ctor      Constructor for the custom activity class
+
+@see DEFINE_RESERVED_NODEACTIVITY
+@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, _S8(#name)}; \
+		DEFINE_TRIPLES_TABLE( name :: iData )
+
+#else
+
+/**
+Define and export a custom node activity.
+
+@param id        Identifier for the activity
+@param name      The name of the activity
+@param msgtype   Message which will kickoff this activity
+@param ctor      Constructor for the custom activity class
+
+@see DEFINE_RESERVED_CUSTOM_NODEACTIVITY
+*/
+	#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}; \
+		DEFINE_TRIPLES_TABLE( name :: iData )
+
+/**
+Define a custom node activity. A custom node activity is a node activity which defines its own
+node activity class. This is used, for example, if the activity wishes to share some custom context
+information between the states and transition in the activity.
+
+Node activity class must derive from CNodeActivityBase.
+
+@param id        Identifier for the activity
+@param name      The name of the activity
+@param msgtype   Message which will kickoff this activity
+@param ctor      Constructor for the custom activity class
+
+@see DEFINE_RESERVED_NODEACTIVITY
+@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}; \
+		DEFINE_TRIPLES_TABLE( name :: iData )
+
+#endif
+
+/**
+Define and declare a custom node activity
+
+@param id        Identifier for the activity
+@param name      The name of the activity
+@param msgtype   Message which will kickoff this activity
+@param ctor      Constructor for the custom activity class
+
+@see DEFINE_RESERVED_CUSTOM_NODEACTIVITY
+*/
+#define DECLARE_DEFINE_RESERVED_CUSTOM_NODEACTIVITY( id, name, msgtype, ctor ) \
+	DECLARE_RESERVED_NODEACTIVITY( name ) \
+	DEFINE_RESERVED_CUSTOM_NODEACTIVITY( id, name, msgtype, ctor )
+
+/**
+END OF RESERVED MACROS
+*/
+
+/**
 Mark the end of an activity map. This macro should be used for an activity map based
 on other activity maps.
 
@@ -432,6 +552,7 @@
 
 namespace MeshMachine
 {
+
 /**
 Base class for all node activity objects. Non custom node activities will use this by default.
 **/
@@ -846,7 +967,14 @@
 	@param aNode        The node to which this activity will belong.
 	@return Generated unique component of activity id
 	*/
-	IMPORT_C static TUint GetNextActivityCountL( const TNodeActivity& aActivitySig, const AMMNodeBase& aNode );
+	static TUint GetNextActivityCountL( const TNodeActivity& aActivitySig, const AMMNodeBase& aNode );
+	/**
+	For use by custom activity News to generate the unique part of the activity id.
+	@param aActivitySig Context information about how the activity is to be started
+	@param aNode        The node to which this activity will belong.
+	@return Generated unique component of activity id
+	*/
+	IMPORT_C static TUint GetNextActivityCount( const TNodeActivity& aActivitySig, const AMMNodeBase& aNode );
 
 	/**
 	Constructor for CNodeParallelActivityBase
@@ -1387,6 +1515,13 @@
     static MeshMachine::CNodeActivityBase* NewL(const MeshMachine::TNodeActivity& aActivitySig, MeshMachine::AMMNodeBase& aNode);
 	};
 
+
+inline TUint CNodeParallelActivityBase::GetNextActivityCountL( const TNodeActivity& aActivitySig, const AMMNodeBase& aNode )
+    {
+    //Historical. Method ceased to leave, but must keep the old, L-ending overload.
+    return GetNextActivityCount(aActivitySig, aNode);
+    }
+
 } //namespace MeshMachine
 
 #endif //SYMBIAN_MM_ACTIVITIES_H
--- a/commsfwsupport/commselements/meshmachine/inc/mm_activities_internal.h	Mon May 03 13:39:24 2010 +0300
+++ b/commsfwsupport/commselements/meshmachine/inc/mm_activities_internal.h	Fri May 14 14:12:43 2010 +0100
@@ -46,15 +46,29 @@
 /**
 */
 	{
+	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 
+	    and peer and it is therefore more powerful. This new ctor has been introduced to aid leave activities to be infallible
+		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) */
 	typedef CNodeActivityBase* (*TStaticActivityCtor)(const TNodeActivity& aActivitySig, AMMNodeBase& aNode);
+	typedef CNodeActivityBase* (*TStaticActivityContextCtor)(const TNodeActivity& aActivitySig, TNodeContextBase& aCtx);
 	const TUint8 iId;
+	const TUint8 iFlags;
 	//Message starting the activity (state in iFirstTriple is waiting for),
 	//used by error handling, could be NULL for "single triple" activities because
 	//than the current message associated with context is used.
     const TUint16 iKickOffMessageId;
     const TUint32 iKickOffMessageRealm;
 	const NetStateMachine::TStateTriple& iFirstTriple;
-	const TStaticActivityCtor iCtor;
+	const TAny* iCtor;
 	const TText8* iName;
 	};
 
--- a/commsfwsupport/commselements/meshmachine/src/mm_activities.cpp	Mon May 03 13:39:24 2010 +0300
+++ b/commsfwsupport/commselements/meshmachine/src/mm_activities.cpp	Fri May 14 14:12:43 2010 +0100
@@ -45,7 +45,9 @@
 enum
 	{
 	EPanicCorruptedContext = 1,
-	EPanicNoPreallocatedSpace = 2
+	EPanicNoPreallocatedSpace = 2,
+	EPanicOutOfActivities = 3,
+	EPanicOutOfBounds
 	};
 
 //-=========================================================
@@ -352,8 +354,8 @@
 		if (PostToOriginator(iOriginators[n], aMessage))
 			{
 			++msgSendCount;
-	    	iOriginators[n].Peer().SetFlags(aFlagsToSet);
-	    	iOriginators[n].Peer().ClearFlags(aFlagsToClear);
+	    	iOriginators[n].SetFlags(aFlagsToSet);
+	    	iOriginators[n].ClearFlags(aFlagsToClear);
 			};
 		}
 	return msgSendCount;
@@ -461,20 +463,80 @@
     aInterface = this;
     }
 
+// BitMap utility used only by CNodeParallelActivityBase::GetNextActivityCount
+template<TInt SIZE>
+class TBitmap {
+public:
+    static const TInt iSize = sizeof(TUint32) * 8;
+    static const TUint32 iSizeMask = iSize - 1;
+    static const TUint32 iFull = ~0;
+    static const TInt iCount = (SIZE + iSizeMask) / iSize;
+    TBitmap();
+    void SetBit(TUint aBitNum);
+    TInt GetFreeBit() const;
+
+private:
+    TUint32 iBits[iCount];
+};
+
+template<TInt SIZE>
+TBitmap<SIZE>::TBitmap()
+{
+    for (TInt i = 0 ; i < iCount ; ++i)
+        {
+        iBits[i] = 0;
+        }
+}
+
+template<TInt SIZE>
+void TBitmap<SIZE>::SetBit(TUint aBitNum)
+    {
+    const TInt index = aBitNum / iSize;
+	__ASSERT_ALWAYS(index < iCount,User::Panic(KMMActivityPanic,EPanicOutOfBounds));
+
+    iBits[index] |= 1 << (aBitNum & iSizeMask);
+    }
+
+template<TInt SIZE>
+TInt TBitmap<SIZE>::GetFreeBit() const
+    {
+    for (TInt i = 0 ; i < iCount ; ++i)
+        {
+        const TUint32 bits = iBits[i];
+        if (bits != iFull)
+            {
+			// Bitmap represents list of activity IDs. Activity ID 1 is a reserved value.
+			// In order to mirror this fact the first bit of the bitmap is also always reserved
+            TUint32 mask = 2;
+            for (TInt bitIndex = 1 ; bitIndex < iSize ; ++bitIndex)
+                {
+                if ((bits & mask) == 0)
+                    {
+                    return (i * iSize) + bitIndex;
+                    }
+                mask <<= 1;
+                }
+            }
+        }
+    return KErrNotFound;
+    }
+
+
 //-=========================================================
 //
 //CNodeParallelActivityBase
 //
 //-=========================================================
-// For custom activities to implement NewL
-EXPORT_C TUint CNodeParallelActivityBase::GetNextActivityCountL( const TNodeActivity& aActivitySig, const AMMNodeBase& aNode )
+
+
+// For custom activities to implement New
+EXPORT_C TUint CNodeParallelActivityBase::GetNextActivityCount( const TNodeActivity& aActivitySig, const AMMNodeBase& aNode )
 	{
-	TInt c = 1, i = 0;
+	TInt c = 1;
 	
 	const RPointerArray<CNodeActivityBase>& activities = aNode.Activities();
-	RArray<TInt> activityids;
-	CleanupClosePushL(activityids);
-
+	
+	TBitmap<256> activityids;
 	// collect the currently used ids
 	for (TInt i = 0; i < activities.Count(); i++)
 		{
@@ -482,23 +544,12 @@
 		if ((id&0xff) == aActivitySig.iId)
 			{
 			TInt8 uniqueid = id >> 8;
-			activityids.InsertInOrderL(uniqueid);
+			activityids.SetBit(uniqueid);
 			}
 		}
-
-	// find first available.
-	while (i < activityids.Count()
-          && activityids[i] == c)
-		{
-		++i;
-		++c;
-		}
-	CleanupStack::PopAndDestroy(&activityids);
-
-	if(c > KActivityParallelRangeMax>>8)
-		{
-		User::Leave(KErrInUse);
-		}
+	c = activityids.GetFreeBit();
+	
+	__ASSERT_ALWAYS(c>=0,User::Panic(KMMActivityPanic,EPanicOutOfActivities));
     return c;
 	}
 
--- a/commsfwsupport/commselements/meshmachine/src/mm_node.cpp	Mon May 03 13:39:24 2010 +0300
+++ b/commsfwsupport/commselements/meshmachine/src/mm_node.cpp	Fri May 14 14:12:43 2010 +0100
@@ -26,7 +26,6 @@
 #include <elements/nm_messages_base.h>
 #include <elements/nm_messages_child.h>
 
-
 #ifdef _DEBUG
 // Panic category for "absolutely impossible!" vanilla ASSERT()-type panics from this module
 // (if it could happen through user error then you should give it an explicit, documented, category + code)
@@ -458,25 +457,31 @@
       	        TInt idx = aContext.iNodeActivity->FindOriginator(aCommsId);
       	        if (KErrNotFound!=idx)
       	        	{
+                    TBool canSend = ETrue;
 					if(aContext.iNodeActivity->iOriginators.Count() == 1) // only if this is the final originator
 						{
 						aContext.iNodeActivity->SetError(KErrAbort);
            	        	aContext.iNodeActivity->Cancel(aContext);
+           	        	//This is a workaround for CCommsBinderRequest. The proper fix is to abolish the concept of aborting activities.
+                        //Aborting activities is a bad idea as an aborted activity isn't given a chance to perform graceful cleanup.
+           	        	//Today activities get aborted because their orinators urgently leave. I.e.: they are trully leaving now! Last orders!
+           	        	//It is then incorrect to leave the activity d'tor to finish the wrap up - because the node will be gone by then.
+           	        	//So whether and when to send an error must be decided here, by this generic code that has no clue on the subtleties
+           	        	//of individual activities. If there is no abort - there is urgent leavers. They send TLeaveRequest and they politely
+           	        	//wait for the completion and all this code is unnecessary.
+           	        	canSend = (aContext.iNodeActivity->Error() != KErrNone);
 						}
-					
-    					
+                    
                     //In the "quiet mode", when the hosting node is being destroyed, we can not afford sending
                     //an error to the node as it would hit void.
                     TNodePeerId& originator = aContext.iNodeActivity->iOriginators[idx];
-                    TBool canSend = !((aIsNodeBeingDestroyed && originator == aContext.NodeId())
-                        || aContext.iMessage.IsMessage<TEChild::TLeft>());
+                    canSend &= !((aIsNodeBeingDestroyed && originator == aContext.NodeId())
+                        || aContext.iMessage.IsMessage<TEChild::TLeft>()); 
                     if (canSend)
                         {
                         aContext.iNodeActivity->PostToOriginator(originator, TEBase::TError(aContext.iMessage.MessageId(), KErrAbort).CRef());
                         }
-    					
-
-	 	        	aContext.iNodeActivity->RemoveOriginator(idx);
+                    aContext.iNodeActivity->RemoveOriginator(idx);
       	        	}
       	        }
             }
@@ -616,21 +621,36 @@
 
 void AMMNodeBase::StartActivityL(TNodeContextBase& aContext, const TNodeActivity& aActivitySig, const NetStateMachine::TStateTriple& aFirst)
     {
-    CNodeActivityBase* a = aActivitySig.iCtor(aActivitySig,*this);
-    if (iActivities.Find(a)==KErrNotFound)
+	CNodeActivityBase* nodeActivity;
+	// Activity is based on one of 2 declarations. One of which has an extra member. In the case of the instance
+	// with a second member the activities Ctor will point to this second member. Since the first member is a TNodeActivity
+	// We can compare the activities Ctor pointer to the address of the second member to assess which type of declarations
+	// this is.
+	
+	if (aActivitySig.iFlags & TNodeActivity::EContextCtor)
+		{ // TNodeActivity's iCtor is a pointer to Activity Ctor
+		nodeActivity = ((TNodeActivity::TStaticActivityContextCtor)aActivitySig.iCtor)(aActivitySig,aContext);
+		}
+	else
+		{ // TNodeActivity's iCtor is a pointer to activity constructor
+		nodeActivity = ((TNodeActivity::TStaticActivityCtor)aActivitySig.iCtor)(aActivitySig,*this);
+		}
+
+    if (iActivities.Find(nodeActivity)==KErrNotFound)
     	{
     	//The activity did not add itself to the list in any special way, append it here
-	    CleanupStack::PushL(a);
-   		a->AppendActivityL();
-	    CleanupStack::Pop(a);
+	    CleanupStack::PushL(nodeActivity);
+   		nodeActivity->AppendActivityL();
+	    CleanupStack::Pop(nodeActivity);
 		}
+
 	//assign only after the activity is successfully appended
-	aContext.iNodeActivity = a;
+	aContext.iNodeActivity = nodeActivity;
 
     //if StartL leaves the "a" will be removed from the array and deleted in ::PostReceived
     //since it will be idle
     XNodePeerId originator(aContext.iSender, aContext.iPeer);
-    a->StartL(aContext, originator, aFirst);
+    nodeActivity->StartL(aContext, originator, aFirst);
     }
 
 void AMMNodeBase::PreallocateSpaceL(TUint aSize)
--- a/commsfwsupport/commselements/nodemessages/bwins/nodemessagesu.def	Mon May 03 13:39:24 2010 +0300
+++ b/commsfwsupport/commselements/nodemessages/bwins/nodemessagesu.def	Fri May 14 14:12:43 2010 +0100
@@ -37,7 +37,7 @@
 	??8TNodeIdRemainder@Messages@@QBEHABVTRuntimeCtxId@1@@Z @ 36 NONAME ; int Messages::TNodeIdRemainder::operator==(class Messages::TRuntimeCtxId const &) const
 	??8TRuntimeCtxId@Messages@@QBEHABV01@@Z @ 37 NONAME ; int Messages::TRuntimeCtxId::operator==(class Messages::TRuntimeCtxId const &) const
 	??ATClientIterBase@Messages@@QAEPAVRNodeInterface@1@H@Z @ 38 NONAME ; class Messages::RNodeInterface * Messages::TClientIterBase::operator[](int)
-	?AddClientL@ANodeBase@Messages@@QAEPAVRNodeInterface@2@ABVTNodeId@2@ABVTClientType@2@PAX@Z @ 39 NONAME ; class Messages::RNodeInterface * Messages::ANodeBase::AddClientL(class Messages::TNodeId const &, class Messages::TClientType const &, void *)
+	?AddClientL@ANodeBase@Messages@@UAEPAVRNodeInterface@2@ABVTNodeId@2@ABVTClientType@2@PAX@Z @ 39 NONAME ; class Messages::RNodeInterface * Messages::ANodeBase::AddClientL(class Messages::TNodeId const &, class Messages::TClientType const &, void *)
 	?AddPersistentItf@CGlobals@Messages@@QAEXABVTNodeId@2@@Z @ 40 NONAME ABSENT ; void Messages::CGlobals::AddPersistentItf(class Messages::TNodeId const &)
 	?Close@RClientInterface@Messages@@QAEXXZ @ 41 NONAME ; void Messages::RClientInterface::Close(void)
 	?Close@RNodeInterface@Messages@@QAEXXZ @ 42 NONAME ; void Messages::RNodeInterface::Close(void)
@@ -201,5 +201,8 @@
 	?GetVDataTableStatic@TSigNodeIdNumberNumberNumber@Messages@@SAPBUSVDataTableEntry@Meta@@XZ @ 200 NONAME ; struct Meta::SVDataTableEntry const * Messages::TSigNodeIdNumberNumberNumber::GetVDataTableStatic(void)
 	?GetVDataTableStatic@TSigTypeId@Messages@@SAPBUSVDataTableEntry@Meta@@XZ @ 201 NONAME ; struct Meta::SVDataTableEntry const * Messages::TSigTypeId::GetVDataTableStatic(void)
 	?GetVDataTableStatic@TSigTypeIdAnyNumber@Messages@@SAPBUSVDataTableEntry@Meta@@XZ @ 202 NONAME ; struct Meta::SVDataTableEntry const * Messages::TSigTypeIdAnyNumber::GetVDataTableStatic(void)
+	??1RNodeInterface@Messages@@UAE@XZ @ 203 NONAME ; Messages::RNodeInterface::~RNodeInterface(void)
+	?PreAllocL@RNodeInterface@Messages@@AAEXI@Z @ 204 NONAME ; void Messages::RNodeInterface::PreAllocL(unsigned int)
+	??0RNodeInterface@Messages@@QAE@XZ @ 205 NONAME ; Messages::RNodeInterface::RNodeInterface(void)
+	?ClaimPreallocatedSpace@RNodeInterface@Messages@@AAEPAXI@Z @ 206 NONAME ; void * Messages::RNodeInterface::ClaimPreallocatedSpace(unsigned int)
 
-
--- a/commsfwsupport/commselements/nodemessages/eabi/nodemessagesu.def	Mon May 03 13:39:24 2010 +0300
+++ b/commsfwsupport/commselements/nodemessages/eabi/nodemessagesu.def	Fri May 14 14:12:43 2010 +0100
@@ -331,5 +331,13 @@
 	_ZTVN8Messages13TSigMessageIdE @ 330 NONAME
 	_ZTVN8Messages19TSigTypeIdAnyNumberE @ 331 NONAME
 	_ZTVN8Messages28TSigNodeIdNumberNumberNumberE @ 332 NONAME
+	_ZN8Messages14RNodeInterface22ClaimPreallocatedSpaceEj @ 333 NONAME
+	_ZN8Messages14RNodeInterface9PreAllocLEj @ 334 NONAME
+	_ZN8Messages14RNodeInterfaceC1Ev @ 335 NONAME
+	_ZN8Messages14RNodeInterfaceC2Ev @ 336 NONAME
+	_ZN8Messages14RNodeInterfaceD0Ev @ 337 NONAME
+	_ZN8Messages14RNodeInterfaceD1Ev @ 338 NONAME
+	_ZN8Messages14RNodeInterfaceD2Ev @ 339 NONAME
+	_ZTIN8Messages14RNodeInterfaceE @ 340 NONAME
+	_ZTVN8Messages14RNodeInterfaceE @ 341 NONAME
 
-
--- a/commsfwsupport/commselements/nodemessages/inc/nm_interfaces.h	Mon May 03 13:39:24 2010 +0300
+++ b/commsfwsupport/commselements/nodemessages/inc/nm_interfaces.h	Fri May 14 14:12:43 2010 +0100
@@ -33,6 +33,17 @@
 _LIT(KSpecAssert_ElemNodeMessIntH, "ElemNodeMessIntH");
 #endif
 
+// Forward declarations to be used with RNodeInterface to allow for friend assignment
+namespace ESock
+	{
+	class CMMCommsProviderBase;
+	}
+
+namespace CprClientLeaveActivity
+	{
+	class CClientLeaveActivity;
+	}
+
 namespace Messages
 {
 
@@ -288,7 +299,16 @@
 	{
 	friend class TClientIterBase;
 
+	// Friend classes needed to allow access to memory preallocation functionality
+	// This friend funtionality is to be removed when the preallocation functionality is revisited
+	// These friends are not to be used for any further functionality
+	friend class ESock::CMMCommsProviderBase;
+	friend class CprClientLeaveActivity::CClientLeaveActivity;
+
 public:
+	IMPORT_C RNodeInterface();
+	IMPORT_C virtual ~RNodeInterface();
+
 	IMPORT_C void Open(TNodeId aPostTo, const TClientType& aClientType = TClientType::NullType(), MTransportSender* aSender = NULL);
 	IMPORT_C void Close();
 	IMPORT_C TBool operator==(const RNodeInterface& aRHS) const;
@@ -367,8 +387,40 @@
 #endif
 	    }
 
+// Handling of preallocating memory to be used by the Leave activity
+private:
+	IMPORT_C void PreAllocL(TUint aAllocSize);
+
+	/**
+	Claim some preallocated memory from the RNodeInterface. This preallocated memory is used for activities that
+	absolutely cannot fail in any scenario, such as for Leaving the node. For this reason, when the
+	RNodeInterface is created, some memory is allocated so that a leaving activity can't even fail in an out
+	of memory situation.
+
+	This method is static as the memory must be claimed before the activity object is constructed.
+
+	@param aNode The node that owns the preallocated space. This must be the node that the activity runs on.
+	@param aSize Size of buffer to allocate.
+
+	@return A pointer to the allocated block of memory
+	*/
+	IMPORT_C TAny* ClaimPreallocatedSpace(TUint aSize);
+
 protected:
 	TClientType iClientType;
+private:
+	struct TPreAllocStore
+		{
+		TPreAllocStore()
+			{
+			iPreAllocSize=0;
+			iPreAllocatedActivityChunk=NULL;
+			}
+		TUint iPreAllocSize;
+		TAny* iPreAllocatedActivityChunk;
+		};
+
+	TPreAllocStore* iPreAlloc;
 	};
 
 class RRequestOriginator
--- a/commsfwsupport/commselements/nodemessages/inc/nm_node.h	Mon May 03 13:39:24 2010 +0300
+++ b/commsfwsupport/commselements/nodemessages/inc/nm_node.h	Fri May 14 14:12:43 2010 +0100
@@ -127,7 +127,7 @@
 
 public:
     IMPORT_C virtual RNodeInterface* NewClientInterfaceL(const TClientType& aClientType, TAny* aClientInfo = NULL);
-    IMPORT_C RNodeInterface* AddClientL(const TNodeId& aClientId, const TClientType& aClientType, TAny* aClientInfo = NULL);
+    IMPORT_C virtual RNodeInterface* AddClientL(const TNodeId& aClientId, const TClientType& aClientType, TAny* aClientInfo = NULL);
     IMPORT_C void RemoveClient(RNodeInterface& aClient);
     IMPORT_C void RemoveClient(TInt aIndex);
     inline const TNodeId& Id() const
--- a/commsfwsupport/commselements/nodemessages/src/nm_interfaces.cpp	Mon May 03 13:39:24 2010 +0300
+++ b/commsfwsupport/commselements/nodemessages/src/nm_interfaces.cpp	Fri May 14 14:12:43 2010 +0100
@@ -115,6 +115,15 @@
 *
 *
 *******************************************************************************************************/
+
+EXPORT_C RNodeInterface::RNodeInterface() : iPreAlloc(NULL)
+	{}
+
+EXPORT_C RNodeInterface::~RNodeInterface()
+	{
+	__ASSERT_DEBUG(iPreAlloc == NULL, User::Panic(KSpecAssert_ElemNodeMessIntC, 1));
+	}
+
 EXPORT_C void RNodeInterface::Open(TNodeId aPostTo, const TClientType& aClientType, MTransportSender* aSender)
 /*
 Opens 'this'.
@@ -129,9 +138,14 @@
 	{
 	RClientInterface::Close();
 	iClientType = TClientType::NullType();
+	if(iPreAlloc!=NULL)
+		{
+		delete iPreAlloc->iPreAllocatedActivityChunk;
+		}
+	delete iPreAlloc;
+	iPreAlloc = NULL;
 	}
 
-
 EXPORT_C void RNodeInterface::PostMessage(const TRuntimeCtxId& aPostFrom, const TNodeId::TRemainder& aPostTo, const TSignalBase& aMessage) const
 	{
 	TUint8 postTo[__Align8(TRuntimeCtxId::KMaxInlineAddressSize)];
@@ -149,6 +163,40 @@
 	return RecipientId() == aRHS.RecipientId();
 	}
 
+EXPORT_C void RNodeInterface::PreAllocL(TUint aAllocSize)
+/**	Pre-allocates memory and stores the pointer and its size
+@param size of memory space to prealloc
+*/
+	{
+	if(iPreAlloc!=NULL)
+		// Memory already allocated for this client
+		{
+		__ASSERT_DEBUG(iPreAlloc->iPreAllocatedActivityChunk != NULL, User::Panic(KSpecAssert_ElemNodeMessIntC, 5));
+		return;
+		}
+	iPreAlloc = new (ELeave) TPreAllocStore();
+	iPreAlloc->iPreAllocatedActivityChunk = User::AllocL(aAllocSize);
+	iPreAlloc->iPreAllocSize = aAllocSize;
+	}
+
+EXPORT_C TAny* RNodeInterface::ClaimPreallocatedSpace(TUint aSize)
+/**	Finds a pointer of the requested size from the preallocation array (see PreallocActivitySpaceL) and returns it
+@param size of memory space requested
+@return pointer to memory allocation or NULL if no preallocation and allocation here fails
+*/
+	{
+	if(!(iPreAlloc && aSize <= iPreAlloc->iPreAllocSize))
+		{
+		// By this stage the PreAllocL must have been triggered and memory space must have been allocated.
+		__ASSERT_DEBUG(EFalse, User::Panic(KSpecAssert_ElemNodeMessIntC, 3));
+		delete iPreAlloc->iPreAllocatedActivityChunk;
+		iPreAlloc->iPreAllocatedActivityChunk = User::AllocL(aSize);
+		}
+	TAny* preallocatedSpace = (RNodeInterface*)iPreAlloc->iPreAllocatedActivityChunk;
+	iPreAlloc->iPreAllocatedActivityChunk=NULL;
+	return preallocatedSpace;
+	}
+
 /******************************************************************************************************
 *
 *
@@ -204,7 +252,7 @@
 
 EXPORT_C void RRequestOriginator::Open(RRequestOriginator& aOriginalRequest)
 	{
-	__ASSERT_DEBUG(aOriginalRequest.IsOpen(), User::Panic(KSpecAssert_ElemNodeMessIntC, 1));
+	__ASSERT_DEBUG(aOriginalRequest.IsOpen(), User::Panic(KSpecAssert_ElemNodeMessIntC, 4));
 	iNode = aOriginalRequest.iNode;
 	iRemainder = aOriginalRequest.iRemainder;
 	aOriginalRequest.Close();
--- a/datacommsserver/esockserver/CoreProviders/bwins/coreprovidersU.DEF	Mon May 03 13:39:24 2010 +0300
+++ b/datacommsserver/esockserver/CoreProviders/bwins/coreprovidersU.DEF	Fri May 14 14:12:43 2010 +0100
@@ -193,7 +193,7 @@
 	?TransitionTag@TAddClientOrUpdatePriority@CControlClientJoinActivity@CprControlClientJoinActivity@@UAEHXZ @ 192 NONAME ; int CprControlClientJoinActivity::CControlClientJoinActivity::TAddClientOrUpdatePriority::TransitionTag(void)
 	?DoL@TSendLeaveCompleteIfRequest@CClientLeaveActivity@CprClientLeaveActivity@@UAEXXZ @ 193 NONAME ; void CprClientLeaveActivity::CClientLeaveActivity::TSendLeaveCompleteIfRequest::DoL(void)
 	?DoL@TAddControlClient@CprStates@@UAEXXZ @ 194 NONAME ; void CprStates::TAddControlClient::DoL(void)
-	?NewL@CClientLeaveActivity@CprClientLeaveActivity@@SAPAVCNodeActivityBase@MeshMachine@@ABUTNodeActivity@4@AAVAMMNodeBase@4@@Z @ 195 NONAME ; class MeshMachine::CNodeActivityBase * CprClientLeaveActivity::CClientLeaveActivity::NewL(struct MeshMachine::TNodeActivity const &, class MeshMachine::AMMNodeBase &)
+	?New@CClientLeaveActivity@CprClientLeaveActivity@@SAPAVCNodeActivityBase@MeshMachine@@ABUTNodeActivity@4@AAVTNodeContextBase@4@@Z @ 195  NONAME ; class MeshMachine::CNodeActivityBase * CprClientLeaveActivity::CClientLeaveActivity::New(struct MeshMachine::TNodeActivity const &, class MeshMachine::TNodeContextBase &)
 	??1CControlClientJoinActivity@CprControlClientJoinActivity@@UAE@XZ @ 196 NONAME ; CprControlClientJoinActivity::CControlClientJoinActivity::~CControlClientJoinActivity(void)
 	?GetVTablePtr@TProcessDataClientRejoin@MCprStates@@SAPAVMStateTransition@NetStateMachine@@AAVTDesC8@@PAX@Z @ 197 NONAME ; class NetStateMachine::MStateTransition * MCprStates::TProcessDataClientRejoin::GetVTablePtr(class TDesC8 &, void *)
 	??0CContentionManager@@QAE@ABVCTierManagerBase@ESock@@@Z @ 198 NONAME ; CContentionManager::CContentionManager(class ESock::CTierManagerBase const &)
--- a/datacommsserver/esockserver/CoreProviders/eabi/coreprovidersU.DEF	Mon May 03 13:39:24 2010 +0300
+++ b/datacommsserver/esockserver/CoreProviders/eabi/coreprovidersU.DEF	Fri May 14 14:12:43 2010 +0100
@@ -413,7 +413,7 @@
 	_ZN22CprClientLeaveActivity20CClientLeaveActivity21TSaveLeaveMessageData3DoLEv @ 412 NONAME
 	_ZN22CprClientLeaveActivity20CClientLeaveActivity27TSendLeaveCompleteIfRequest12GetVTablePtrER6TDesC8Pv @ 413 NONAME
 	_ZN22CprClientLeaveActivity20CClientLeaveActivity27TSendLeaveCompleteIfRequest3DoLEv @ 414 NONAME
-	_ZN22CprClientLeaveActivity20CClientLeaveActivity4NewLERKN11MeshMachine13TNodeActivityERNS1_11AMMNodeBaseE @ 415 NONAME
+	_ZN22CprClientLeaveActivity20CClientLeaveActivity3NewERKN11MeshMachine13TNodeActivityERNS1_16TNodeContextBaseE @ 415 NONAME
 	_ZN22CprClientLeaveActivity20CClientLeaveActivityD0Ev @ 416 NONAME
 	_ZN22CprClientLeaveActivity20CClientLeaveActivityD1Ev @ 417 NONAME
 	_ZN22CprClientLeaveActivity20CClientLeaveActivityD2Ev @ 418 NONAME
--- a/datacommsserver/esockserver/CoreProviders/inc/corecpractivities.h	Mon May 03 13:39:24 2010 +0300
+++ b/datacommsserver/esockserver/CoreProviders/inc/corecpractivities.h	Fri May 14 14:12:43 2010 +0100
@@ -165,7 +165,7 @@
 class CClientLeaveActivity : public CprPriorityUpdateActivity::CPriorityUpdateActivity
 	{
 public:
-	IMPORT_C static MeshMachine::CNodeActivityBase* NewL(const MeshMachine::TNodeActivity& aActivitySig, MeshMachine::AMMNodeBase& aNode);
+	IMPORT_C static MeshMachine::CNodeActivityBase* New(const MeshMachine::TNodeActivity& aActivitySig, MeshMachine::TNodeContextBase& aContext);
 	IMPORT_C virtual ~CClientLeaveActivity();
 
 public:
--- a/datacommsserver/esockserver/CoreProviders/src/corecpractivities.cpp	Mon May 03 13:39:24 2010 +0300
+++ b/datacommsserver/esockserver/CoreProviders/src/corecpractivities.cpp	Fri May 14 14:12:43 2010 +0100
@@ -43,7 +43,16 @@
 using namespace MeshMachine;
 using namespace Messages;
 
-
+//-=========================================================
+//
+//Panics
+//
+//-=========================================================
+_LIT (KCoreCPRActivityPanic,"CoreCPRActivityPanic");
+enum
+	{
+	EPanicNoPrealloc = 1
+	};
 
 //-=========================================================
 //
@@ -202,8 +211,8 @@
 
 namespace CprClientLeaveActivity
 {
-DECLARE_DEFINE_CUSTOM_NODEACTIVITY(ECFActivityClientLeave, CprClientLeave, TNodeSignal::TNullMessageId, CClientLeaveActivity::NewL)
-	FIRST_NODEACTIVITY_ENTRY(CoreStates::TAwaitingClientLeave, MeshMachine::TNoTag)
+DECLARE_DEFINE_RESERVED_CUSTOM_NODEACTIVITY(ECFActivityClientLeave, CprClientLeave, TCFServiceProvider::TLeaveRequest, CClientLeaveActivity::New)
+	FIRST_NODEACTIVITY_ENTRY(MeshMachine::TAwaitingMessageState<TCFServiceProvider::TLeaveRequest>, MeshMachine::TNoTag)
 	THROUGH_NODEACTIVITY_ENTRY(KNoTag, CClientLeaveActivity::TRemoveClientAndDestroyOrphanedDataClients, CClientLeaveActivity::TNoTagOrSendPriorityToCtrlProvider)
 	NODEACTIVITY_ENTRY(CprStates::KSendPriorityToCtrlProvider, CClientLeaveActivity::TUpdatePriorityForControlProvider, CoreStates::TAwaitingJoinComplete, CClientLeaveActivity::TNoTagOrSendPriorityToServProvider)
 	NODEACTIVITY_ENTRY(CprStates::KSendPriorityToServProvider, CClientLeaveActivity::TUpdatePriorityForServiceProviders, CoreStates::TAwaitingJoinComplete, MeshMachine::TNoTag)
@@ -286,10 +295,16 @@
 
 namespace CprClientLeaveActivity
 {
-EXPORT_C MeshMachine::CNodeActivityBase* CClientLeaveActivity::NewL(  const MeshMachine::TNodeActivity& aActivitySig, MeshMachine::AMMNodeBase& aNode )
+EXPORT_C MeshMachine::CNodeActivityBase* CClientLeaveActivity::New(  const MeshMachine::TNodeActivity& aActivitySig, MeshMachine::TNodeContextBase& aContext )
 	{
-	TUint c = GetNextActivityCountL(aActivitySig,aNode);
-	return new(ELeave)CClientLeaveActivity(aActivitySig, aNode, c);
+	TUint c = GetNextActivityCount(aActivitySig,aContext.Node());
+	
+	// Instantiate using memory preallocated and stored in the RCFNodeInterface
+	TAny* preallocatedSpace = aContext.iPeer->ClaimPreallocatedSpace(sizeof(CClientLeaveActivity));
+	__ASSERT_ALWAYS(preallocatedSpace != NULL,User::Panic(KCoreCPRActivityPanic,EPanicNoPrealloc));
+
+	CClientLeaveActivity* self = new(preallocatedSpace)CClientLeaveActivity(aActivitySig, aContext.Node(), c);
+	return self;
 	}
 
 CClientLeaveActivity::CClientLeaveActivity(const MeshMachine::TNodeActivity& aActivitySig, MeshMachine::AMMNodeBase& aNode, TUint aActivitiesCount)
--- a/datacommsserver/esockserver/CoreProviders/src/corescpr.cpp	Mon May 03 13:39:24 2010 +0300
+++ b/datacommsserver/esockserver/CoreProviders/src/corescpr.cpp	Fri May 14 14:12:43 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+ // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of "Eclipse Public License v1.0"
@@ -41,9 +41,9 @@
 
 //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 KSCPRDefaultMaxPreallocatedActivityCount = 2;
 static const TUint KMaxPreallocatedActivitySize = sizeof(MeshMachine::CNodeRetryParallelActivity) + sizeof(MeshMachine::APreallocatedOriginators<4>);
-static const TUint KSCPRPreallocatedActivityBufferSize = KDefaultMaxPreallocatedActivityCount * KMaxPreallocatedActivitySize;
+static const TUint KSCPRPreallocatedActivityBufferSize = KSCPRDefaultMaxPreallocatedActivityCount * KMaxPreallocatedActivitySize;
 
 EXPORT_C CCoreSubConnectionProvider::CCoreSubConnectionProvider(CSubConnectionProviderFactoryBase& aFactory,
                                                                 const MeshMachine::TNodeActivityMap& aActivityMap)
--- a/datacommsserver/esockserver/MobilityCoreProviders/eabi/mobilitycoreprovidersu.def	Mon May 03 13:39:24 2010 +0300
+++ b/datacommsserver/esockserver/MobilityCoreProviders/eabi/mobilitycoreprovidersu.def	Fri May 14 14:12:43 2010 +0100
@@ -52,15 +52,14 @@
 	_ZThn140_N27CMobilityConnectionProviderD0Ev @ 51 NONAME ABSENT
 	_ZThn140_N27CMobilityConnectionProviderD1Ev @ 52 NONAME ABSENT
 	_ZThn20_N27CMobilityConnectionProvider9ReceivedLERKN8Messages13TRuntimeCtxIdERKNS0_7TNodeIdERNS0_14TSignatureBaseE @ 53 NONAME
-	_ZThn152_N27CMobilityConnectionProvider18CancelSubscriptionEj @ 54 NONAME
-	_ZThn152_N27CMobilityConnectionProvider18NewCarrierAcceptedEj @ 55 NONAME
-	_ZThn152_N27CMobilityConnectionProvider18NewCarrierRejectedEj @ 56 NONAME
-	_ZThn152_N27CMobilityConnectionProvider19SubscribeForMessageEjP21CCommsMobilitySrvResp @ 57 NONAME
-	_ZThn152_N27CMobilityConnectionProvider22IgnorePreferredCarrierEj @ 58 NONAME
-	_ZThn152_N27CMobilityConnectionProvider22OpenExtensionInterfaceEjRKN8Messages13TRuntimeCtxIdEPN5ESock21CCommsApiExtResponderE @ 59 NONAME
-	_ZThn152_N27CMobilityConnectionProvider23CloseExtensionInterfaceEj @ 60 NONAME
-	_ZThn152_N27CMobilityConnectionProvider25MigrateToPreferredCarrierEj @ 61 NONAME
-	_ZThn152_N27CMobilityConnectionProviderD0Ev @ 62 NONAME
-	_ZThn152_N27CMobilityConnectionProviderD1Ev @ 63 NONAME
+	_ZThn156_N27CMobilityConnectionProvider18CancelSubscriptionEj @ 54 NONAME
+	_ZThn156_N27CMobilityConnectionProvider18NewCarrierAcceptedEj @ 55 NONAME
+	_ZThn156_N27CMobilityConnectionProvider18NewCarrierRejectedEj @ 56 NONAME
+	_ZThn156_N27CMobilityConnectionProvider19SubscribeForMessageEjP21CCommsMobilitySrvResp @ 57 NONAME
+	_ZThn156_N27CMobilityConnectionProvider22IgnorePreferredCarrierEj @ 58 NONAME
+	_ZThn156_N27CMobilityConnectionProvider22OpenExtensionInterfaceEjRKN8Messages13TRuntimeCtxIdEPN5ESock21CCommsApiExtResponderE @ 59 NONAME
+	_ZThn156_N27CMobilityConnectionProvider23CloseExtensionInterfaceEj @ 60 NONAME
+	_ZThn156_N27CMobilityConnectionProvider25MigrateToPreferredCarrierEj @ 61 NONAME
+	_ZThn156_N27CMobilityConnectionProviderD0Ev @ 62 NONAME
+	_ZThn156_N27CMobilityConnectionProviderD1Ev @ 63 NONAME
 
-
--- a/datacommsserver/esockserver/MobilityCoreProviders/src/mobilitycpr.cpp	Mon May 03 13:39:24 2010 +0300
+++ b/datacommsserver/esockserver/MobilityCoreProviders/src/mobilitycpr.cpp	Fri May 14 14:12:43 2010 +0100
@@ -48,9 +48,9 @@
 
 //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 KMobilityCPRDefaultMaxPreallocatedActivityCount = 2;
 static const TUint KMaxPreallocatedActivitySize = sizeof(MeshMachine::CNodeRetryParallelActivity) + sizeof(MeshMachine::APreallocatedOriginators<4>);
-static const TUint KMobilityCPRPreallocatedActivityBufferSize = KDefaultMaxPreallocatedActivityCount * KMaxPreallocatedActivitySize;
+static const TUint KMobilityCPRPreallocatedActivityBufferSize = KMobilityCPRDefaultMaxPreallocatedActivityCount * KMaxPreallocatedActivitySize;
 
 //-=========================================================
 //
--- a/datacommsserver/esockserver/MobilityCoreProviders/src/mobilitycpractivities.cpp	Mon May 03 13:39:24 2010 +0300
+++ b/datacommsserver/esockserver/MobilityCoreProviders/src/mobilitycpractivities.cpp	Fri May 14 14:12:43 2010 +0100
@@ -197,7 +197,8 @@
 		TErrResponse& resp = message_cast<TEErrorRecovery::TErrorRecoveryResponse>(iContext.iMessage).iErrResponse;
 		if (resp.iAction == TErrResponse::ERetry)
 			{
-		    return KNoTag | NetStateMachine::EBackward;
+			iContext.Activity()->SetError(KErrNone);
+      		return KNoTag | NetStateMachine::EBackward;
 			}
 		else if  (resp.iAction == TErrResponse::EPropagate || resp.iError == KErrCancel)
 			{
--- a/datacommsserver/esockserver/bwins/esocksvrU.DEF	Mon May 03 13:39:24 2010 +0300
+++ b/datacommsserver/esockserver/bwins/esocksvrU.DEF	Fri May 14 14:12:43 2010 +0100
@@ -472,7 +472,7 @@
 	?DoL@TSendBindTo@CoreNetStates@@UAEXXZ @ 471 NONAME ; void CoreNetStates::TSendBindTo::DoL(void)
 	?DoL@TSendBindToComplete@ABindingActivity@CoreActivities@@UAEXXZ @ 472 NONAME ; void CoreActivities::ABindingActivity::TSendBindToComplete::DoL(void)
 	?DoL@TSendBindToComplete@CoreNetStates@@UAEXXZ @ 473 NONAME ; void CoreNetStates::TSendBindToComplete::DoL(void)
-	?DoL@TSendBindToCompleteIfExpected@ABindingActivity@CoreActivities@@UAEXXZ @ 474 NONAME ABSENT; void CoreActivities::ABindingActivity::TSendBindToCompleteIfExpected::DoL(void)
+	?DoL@TSendBindToCompleteIfExpected@ABindingActivity@CoreActivities@@UAEXXZ @ 474 NONAME ABSENT ; void CoreActivities::ABindingActivity::TSendBindToCompleteIfExpected::DoL(void)
 	?DoL@TSendBinderResponse@CCommsBinderActivity@PRActivities@@UAEXXZ @ 475 NONAME ; void PRActivities::CCommsBinderActivity::TSendBinderResponse::DoL(void)
 	?DoL@TSendClientLeavingAndRemoveControlProvider@CoreNetStates@@UAEXXZ @ 476 NONAME ; void CoreNetStates::TSendClientLeavingAndRemoveControlProvider::DoL(void)
 	?DoL@TSendClientLeavingAndRemoveControlProviderIfNoServiceProviders@CoreNetStates@@UAEXXZ @ 477 NONAME ; void CoreNetStates::TSendClientLeavingAndRemoveControlProviderIfNoServiceProviders::DoL(void)
@@ -808,7 +808,7 @@
 	?GetVTablePtr@TSendBindToComplete@ABindingActivity@CoreActivities@@SAPAVMStateTransition@NetStateMachine@@AAVTDesC8@@PAX@Z @ 807 NONAME ; class NetStateMachine::MStateTransition * CoreActivities::ABindingActivity::TSendBindToComplete::GetVTablePtr(class TDesC8 &, void *)
 	?GetVTablePtr@TSendBindToComplete@CBindToActivity@PRActivities@@SAPAVMStateTransition@NetStateMachine@@AAVTDesC8@@PAX@Z @ 808 NONAME ; class NetStateMachine::MStateTransition * PRActivities::CBindToActivity::TSendBindToComplete::GetVTablePtr(class TDesC8 &, void *)
 	?GetVTablePtr@TSendBindToComplete@CoreNetStates@@SAPAVMStateTransition@NetStateMachine@@AAVTDesC8@@PAX@Z @ 809 NONAME ; class NetStateMachine::MStateTransition * CoreNetStates::TSendBindToComplete::GetVTablePtr(class TDesC8 &, void *)
-	?GetVTablePtr@TSendBindToCompleteIfExpected@ABindingActivity@CoreActivities@@SAPAVMStateTransition@NetStateMachine@@AAVTDesC8@@PAX@Z @ 810 NONAME ABSENT; class NetStateMachine::MStateTransition * CoreActivities::ABindingActivity::TSendBindToCompleteIfExpected::GetVTablePtr(class TDesC8 &, void *)
+	?GetVTablePtr@TSendBindToCompleteIfExpected@ABindingActivity@CoreActivities@@SAPAVMStateTransition@NetStateMachine@@AAVTDesC8@@PAX@Z @ 810 NONAME ABSENT ; class NetStateMachine::MStateTransition * CoreActivities::ABindingActivity::TSendBindToCompleteIfExpected::GetVTablePtr(class TDesC8 &, void *)
 	?GetVTablePtr@TSendBinderResponse@CCommsBinderActivity@PRActivities@@SAPAVMStateTransition@NetStateMachine@@AAVTDesC8@@PAX@Z @ 811 NONAME ; class NetStateMachine::MStateTransition * PRActivities::CCommsBinderActivity::TSendBinderResponse::GetVTablePtr(class TDesC8 &, void *)
 	?GetVTablePtr@TSendClientLeavingAndRemoveControlProvider@CoreNetStates@@SAPAVMStateTransition@NetStateMachine@@AAVTDesC8@@PAX@Z @ 812 NONAME ; class NetStateMachine::MStateTransition * CoreNetStates::TSendClientLeavingAndRemoveControlProvider::GetVTablePtr(class TDesC8 &, void *)
 	?GetVTablePtr@TSendClientLeavingAndRemoveControlProviderIfNoServiceProviders@CoreNetStates@@SAPAVMStateTransition@NetStateMachine@@AAVTDesC8@@PAX@Z @ 813 NONAME ; class NetStateMachine::MStateTransition * CoreNetStates::TSendClientLeavingAndRemoveControlProviderIfNoServiceProviders::GetVTablePtr(class TDesC8 &, void *)
@@ -903,7 +903,7 @@
 	?TransitionTag@TBearerPresent@CoreNetStates@@UAEHXZ @ 902 NONAME ; int CoreNetStates::TBearerPresent::TransitionTag(void)
 	?TransitionTag@TBearerReady@CoreNetStates@@UAEHXZ @ 903 NONAME ABSENT ; int CoreNetStates::TBearerReady::TransitionTag(void)
 	?TransitionTag@TDataClientPresent@CoreNetStates@@UAEHXZ @ 904 NONAME ABSENT ; int CoreNetStates::TDataClientPresent::TransitionTag(void)
-	?TransitionTag@TLayerCompleted@CoreNetStates@@UAEHXZ @ 905 NONAME ABSENT ; int CoreNetStates::TLayerCompleted::TransitionTag(void)
+	?Cancel@CCommsBinderActivity@PRActivities@@UAEXAAVTNodeContextBase@MeshMachine@@@Z @ 905 NONAME ; void PRActivities::CCommsBinderActivity::Cancel(class MeshMachine::TNodeContextBase &)
 	?TransitionTag@TNoTagBackwardsOrProviderStopped@CoreNetStates@@UAEHXZ @ 906 NONAME ; int CoreNetStates::TNoTagBackwardsOrProviderStopped::TransitionTag(void)
 	?TransitionTag@TNoTagOrBearerPresent@CNoBearer@PRActivities@@UAEHXZ @ 907 NONAME ; int PRActivities::CNoBearer::TNoTagOrBearerPresent::TransitionTag(void)
 	?FetchNodeInterfaceControlL@CTierManagerBase@ESock@@MAEPAVTInterfaceControl@NetInterfaces@@H@Z @ 908 NONAME ; class NetInterfaces::TInterfaceControl * ESock::CTierManagerBase::FetchNodeInterfaceControlL(int)
@@ -1053,4 +1053,5 @@
 	??0TTierTypeIdFactoryQuery@ESock@@QAE@XZ @ 1052 NONAME ; ESock::TTierTypeIdFactoryQuery::TTierTypeIdFactoryQuery(void)
 	?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 *)
 
--- a/datacommsserver/esockserver/core_states/ss_corepractivities.cpp	Mon May 03 13:39:24 2010 +0300
+++ b/datacommsserver/esockserver/core_states/ss_corepractivities.cpp	Fri May 14 14:12:43 2010 +0100
@@ -1701,6 +1701,27 @@
 	iPendingBinder->SetFlags(TCFClientType::EActivating);
     }
 
+EXPORT_C void CCommsBinderActivity::Cancel(TNodeContextBase& aContext)
+    {
+    if (iPendingBinder)
+        {
+        //iPendingBinder is set when CCommsBinderActivity decides which of its dataclients it 
+        //wishes to send along with its TCommsBinderResponse and promptly (on the same stack) as
+        //this response is sent. After TCommsBinderResponse, the error handling of CCommsBinderActivity
+        //changes in that it should not flag any errors back to the recpient of TCommsBinderResponse.
+        //Such response may be when:
+        //(1) the recipient responds to TCommsBinderResponse with TError - the activity is finished, the recipients doesn't wait for anything (certainly not for an error)
+        //(2) the recipients explicitly cancels (or implicitly cancells by leaving the local node) - the activity is finished, the recipient doesn't wait for anything (certainly not for an error) 
+        SetError(KErrNone);
+        BindToComplete();
+        SetIdle();
+        }
+    else
+        {
+        CNodeRetryParallelActivity::Cancel(aContext);
+        }
+    }
+
 void CCommsBinderActivity::BindToComplete()
     {
     __ASSERT_DEBUG(iPendingBinder, User::Panic(KSpecAssert_ESockCrStaCPRAC, 23));
--- a/datacommsserver/esockserver/core_states/ss_corepractivities.h	Mon May 03 13:39:24 2010 +0300
+++ b/datacommsserver/esockserver/core_states/ss_corepractivities.h	Fri May 14 14:12:43 2010 +0100
@@ -685,6 +685,8 @@
 public:
     static const TInt KInterfaceId = 0x102864DE;
 
+    IMPORT_C virtual void Cancel(MeshMachine::TNodeContextBase& aContext);    
+
 	IMPORT_C static Messages::RNodeInterface* IsDataClientPresent(MeshMachine::TNodeContextBase& aContext, TUint aClientFlags = 0);
 
     IMPORT_C void StoreBinder(Messages::RNodeInterface* aDataClient);
--- a/datacommsserver/esockserver/core_states/ss_coreprstates.cpp	Mon May 03 13:39:24 2010 +0300
+++ b/datacommsserver/esockserver/core_states/ss_coreprstates.cpp	Fri May 14 14:12:43 2010 +0100
@@ -1333,28 +1333,42 @@
 
 EXPORT_DEFINE_SMELEMENT(TAwaitingStarted, NetStateMachine::MState, CoreNetStates::TContext)
 EXPORT_C TBool TAwaitingStarted::Accept()
-	{
+    {
     if (iContext.iMessage.IsMessage<TCFServiceProvider::TStarted>())
         {
-	    if (iContext.iPeer)
-	        {
-			iContext.iPeer->ClearFlags(TCFClientType::EStarting);
-	        iContext.iPeer->SetFlags(TCFClientType::EStarted);
-	        }
-	    return ETrue;
+        if (iContext.iPeer)
+            {
+            iContext.iPeer->ClearFlags(TCFClientType::EStarting);
+            iContext.iPeer->SetFlags(TCFClientType::EStarted);
+            }
+        if (iContext.iNodeActivity)
+            {//The node has responded. Core providers doesn't support the notion of multiple service providers,
+             //therefore this code has been written to expect that TCFServiceProvider::TStart would only ever be
+             //sent to one service provider as a simple request<>response handshake. The client has now responded
+             //and its job is now done. ClearPostedTo so that TCancels aren't forwarded.
+            iContext.iNodeActivity->ClearPostedTo();
+            }
+        return ETrue;
         }
 
-	//If this is TError, clean the EStarting flag but do not accept, clean or otherwise process
-	if (iContext.iMessage.IsMessage<TEBase::TError>())
-    	{
-	    if (iContext.iPeer)
-	        {
-	        iContext.iPeer->ClearFlags(TCFClientType::EStarting);
-	        }
-    	}
+    //If this is TError, clean the EStarting flag but do not accept, clean or otherwise process
+    if (iContext.iMessage.IsMessage<TEBase::TError>())
+        {
+        if (iContext.iPeer)
+            {
+            iContext.iPeer->ClearFlags(TCFClientType::EStarting);
+            }
+        if (iContext.iNodeActivity)
+            {//The node has responded. Core providers doesn't support the notion of multiple service providers,
+             //therefore this code has been written to expect that TCFServiceProvider::TStart would only ever be
+             //sent to one service provider as a simple request<>response handshake. The client has now responded
+             //and its job is now done. ClearPostedTo so that TCancels aren't forwarded.
+            iContext.iNodeActivity->ClearPostedTo();
+            }
+        }
 
-	return EFalse;
-	}
+    return EFalse;
+    }
 
 EXPORT_DEFINE_SMELEMENT(TSendBindToComplete, NetStateMachine::MStateTransition, CoreNetStates::TContext)
 EXPORT_C void TSendBindToComplete::DoL()
@@ -1891,7 +1905,16 @@
 EXPORT_DEFINE_SMELEMENT(TForwardStateChange, NetStateMachine::MStateTransition, PRStates::TContext)
 EXPORT_C void TForwardStateChange::DoL()
 	{
-	//Forward to control clients if there are any
+    //In some cirumstances a node can have more than one TCFClientType::EServProvider peer (for instance MCPRs can have more than one potential service provider), 
+    //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 
+    //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.
+
+    if (iContext.iPeer && 
+        iContext.iPeer->Type() == TCFClientType::EServProvider && 
+        !(iContext.iPeer->Flags() & TCFClientType::EActive) )
+        {
+        return;
+        }
 	TInt ctrlClientCount = iContext.Node().PostToClients<TDefaultClientMatchPolicy>(TNodeCtxId(iContext.ActivityId(), iContext.NodeId()), iContext.iMessage, TClientType(TCFClientType::ECtrl));
 	if (0==ctrlClientCount)
 		{ //If there are no control clients any more, forward to the control provider
--- a/datacommsserver/esockserver/eabi/esocksvrU.DEF	Mon May 03 13:39:24 2010 +0300
+++ b/datacommsserver/esockserver/eabi/esocksvrU.DEF	Fri May 14 14:12:43 2010 +0100
@@ -1031,7 +1031,7 @@
 	_ZN5ESock25RCFParameterFamilyBundleC4OpenEv @ 1030 NONAME
 	_ZN17CConnDataTransfer31DataReceivedNotificationRequestEjj @ 1031 NONAME
 	_ZThn20_N5ESock22CSubConnectionFlowBase26FetchNodeInterfaceControlLEi @ 1032 NONAME
-	_ZThn136_NK5ESock20CMMCommsProviderBase20GetAccessPointConfigEv @ 1033 NONAME
+	_ZThn140_NK5ESock20CMMCommsProviderBase20GetAccessPointConfigEv @ 1033 NONAME
 	_ZN5ESock30TDefaultConnectionFactoryQuery19GetVDataTableStaticEv @ 1034 NONAME
 	_ZN5ESock30TDefaultConnectionFactoryQuery5MatchERN9Factories18TFactoryObjectInfoE @ 1035 NONAME
 	_ZN5ESock30TDefaultConnectionFactoryQueryC1ERKN8Messages7TNodeIdE @ 1036 NONAME
@@ -1712,7 +1712,7 @@
 	_ZN13CoreNetStates15TAwaitingBindTo6AcceptEv @ 1711 NONAME
 	_ZN13CoreNetStates15TLayerCompleted13TransitionTagEv @ 1712 NONAME ABSENT
 	_ZN13CoreNetStates18TAwaitingProvision6AcceptEv @ 1713 NONAME
-	_ZN13CoreNetStates18TDataClientPresent13TransitionTagEv @ 1714 NONAME ABSENT
+	_ZN12PRActivities20CCommsBinderActivity6CancelERN11MeshMachine16TNodeContextBaseE @ 1714 NONAME
 	_ZN13CoreNetStates21TNoTagOrNoDataClients13TransitionTagEv @ 1715 NONAME
 	_ZN13CoreNetStates25TNoTagOrDataClientPresent13TransitionTagEv @ 1716 NONAME
 	_ZN13CoreNetStates25TNoTagOrDataClientsToStop13TransitionTagEv @ 1717 NONAME
@@ -1959,4 +1959,6 @@
 	_ZTIN5ESock23TTierTypeIdFactoryQueryE @ 1958 NONAME
 	_ZTVN5ESock23TTierTypeIdFactoryQueryE @ 1959 NONAME
 	_ZThn4_N5ESock23TTierTypeIdFactoryQuery5MatchERN9Factories18TFactoryObjectInfoE @ 1960 NONAME
+	_ZN5ESock20CMMCommsProviderBase10AddClientLERKN8Messages7TNodeIdERKNS1_11TClientTypeEPv @ 1961 NONAME
+	_ZThn36_N5ESock20CMMCommsProviderBase10AddClientLERKN8Messages7TNodeIdERKNS1_11TClientTypeEPv @ 1962 NONAME
 
--- a/datacommsserver/esockserver/inc/ss_mmcommsprov.h	Mon May 03 13:39:24 2010 +0300
+++ b/datacommsserver/esockserver/inc/ss_mmcommsprov.h	Fri May 14 14:12:43 2010 +0100
@@ -71,10 +71,13 @@
 	friend class IpCprStates::TSendParamsToSelf;
 	friend class IpCprStates::TUpdateNetMCPR;
 	friend class PRStates::TRespondWithRetrievedParams;
-
+	
 public:
 	typedef ITFHIERARCHY_LINK_1(CMMCommsProviderBase, MeshMachine::AMMNodeBase, MAccessPointConfigApi) TIfStaticFetcherNearestInHierarchy;
 	IMPORT_C void ReturnInterfacePtrL(MAccessPointConfigApi*& aInterface);
+
+	IMPORT_C virtual Messages::RNodeInterface* AddClientL(const Messages::TNodeId& aClientId, const Messages::TClientType& aClientType, TAny* aClientInfo = NULL);
+
 	void DestroyOrphanedDataClients();
 
 	IMPORT_C void SetParametersL(const RCFParameterFamilyBundleC& aParameterBundle);
--- a/datacommsserver/esockserver/ssock/ss_conn.cpp	Mon May 03 13:39:24 2010 +0300
+++ b/datacommsserver/esockserver/ssock/ss_conn.cpp	Fri May 14 14:12:43 2010 +0100
@@ -316,7 +316,7 @@
 DECLARE_DEFINE_CUSTOM_NODEACTIVITY(ECFActivityGoneDown, ConnectionGoingDown, TCFControlClient::TGoneDown, PRActivities::CGoneDownActivity::NewL)
 	FIRST_NODEACTIVITY_ENTRY(ConnStates::TAwaitingGoneDown, MeshMachine::TNoTag)
 	THROUGH_NODEACTIVITY_ENTRY(KNoTag, ConnectionGoingDownActivity::TStoreGoneDownError, MeshMachine::TNoTag)
-	THROUGH_NODEACTIVITY_ENTRY(KNoTag, CoreNetStates::TCancelAndCloseZone0ClientExtIfaces, MeshMachine::TNoTag)
+	THROUGH_NODEACTIVITY_ENTRY(KNoTag, SubSessStates::TCancelAndCloseClientExtIfaces, MeshMachine::TNoTag)
     THROUGH_NODEACTIVITY_ENTRY(KNoTag, ConnStates::TCancelAllLegacyRMessage2Activities, ConnStates::TNoTagBlockedByLegacyRMessage2Activities)
     THROUGH_NODEACTIVITY_ENTRY(KNoTag, ConnStates::TGenerateConnectionDownProgress, MeshMachine::TNoTag)
 	NODEACTIVITY_ENTRY(KNoTag, CoreNetStates::TSendClientLeavingRequestToServiceProviders, MeshMachine::TAwaitingLeaveComplete, MeshMachine::TNoTag)
--- a/datacommsserver/esockserver/ssock/ss_mmcommsprov.cpp	Mon May 03 13:39:24 2010 +0300
+++ b/datacommsserver/esockserver/ssock/ss_mmcommsprov.cpp	Fri May 14 14:12:43 2010 +0100
@@ -19,7 +19,8 @@
 
 #include "ss_mmcommsprov.h"
 #include <elements/nm_messages_child.h>
-#include <elements/mm_activities.h> 
+#include <elements/mm_activities.h>
+#include <comms-infras/corecpractivities.h> 
 #include "ss_nodemessages_internal.h"
 #include "ss_internal_activities.h"
 
@@ -32,6 +33,10 @@
 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),
@@ -112,6 +117,23 @@
 	aInterface = this;
 	}
 
+EXPORT_C RNodeInterface* CMMCommsProviderBase::AddClientL(const Messages::TNodeId& aClientId, const Messages::TClientType& aClientType, TAny* aClientInfo)
+	{
+	RNodeInterface* nodeInterface = ANodeBase::AddClientL(aClientId, aClientType, aClientInfo);
+
+	if(aClientType.Type() == TCFClientType::ECtrl)
+		{
+		TRAPD(err, nodeInterface->PreAllocL(KMaxPreallocatedActivitySize));
+		if(err!=KErrNone)
+			{
+			RemoveClient(nodeInterface->RecipientId());
+			User::Leave(err);
+			}
+		}
+
+	return nodeInterface;
+	}
+
 void CMMCommsProviderBase::DestroyOrphanedDataClients()
 	{
     // Note: If PRDataClientStopActivity is running, it will call PRStates::TDestroyOrphanedDataClients
--- a/datacommsserver/esockserver/ssock/ss_sapshim.cpp	Mon May 03 13:39:24 2010 +0300
+++ b/datacommsserver/esockserver/ssock/ss_sapshim.cpp	Fri May 14 14:12:43 2010 +0100
@@ -1369,6 +1369,17 @@
 	        {
             iHostResolverNotify->Error(KErrDisconnected);
 	        }
+	    else
+	    if (iFlowParams.iFlowRequestType == TFlowParams::EExplicitConnection)
+	        {
+            // Re-issue explicit host resolver requests here rather than later on in StartFlowL().  This is
+            // to accomodate the HotSpot server and Internet Connectivity Test (ICT).  The ICT hooks into the
+            // NetCfgExtensionBase mechanism, blocks the interface startup at 8400 and performs a host resolver
+            // request.  However, the TransportFlowShim will only receive StartFlowL() after the interface has
+            // fully come up, so chicken and egg.  Implicit host resolver requests must still be re-issued in
+            // StartFlowL().
+            iHostResolverNotify->StartSending();
+	        }
 	    }
 	}
 
@@ -1409,8 +1420,9 @@
 		SetStarted();
 		ClearStopped();
 
-        // A held-over resolution request will now work (if it ever will)
-        if (iHostResolverNotify)
+        // A held-over implicit resolution request will now work (if it ever will).
+		// Explicit host resolver requests have already been re-issued in BindToL().
+        if (iHostResolverNotify && (iFlowParams.iFlowRequestType != TFlowParams::EExplicitConnection))
 	        {
     	    iHostResolverNotify->StartSending();
 	        }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/datacommsserver/esockserver/test/TE_DummyProvider/configs/te_dummyprovider_006.ini	Fri May 14 14:12:43 2010 +0100
@@ -0,0 +1,28 @@
+[CreateSockSvr1]
+SocketServName=SockSvr1
+
+[CreateConn1]
+ConnName=Conn1
+
+[ConnectSockSvr1]
+SocketServName=SockSvr1
+
+[OpenConn1]
+ConnName=Conn1
+SocketServName=SockSvr1
+ConnType=271069227
+
+[StartConn1]
+ConnName=Conn1
+SocketServName=SockSvr0
+SNAP=60
+
+[StopConn1]
+ConnName=Conn1
+ConnStopType=EStopNormal
+
+[CloseConn1]
+ConnName=Conn1
+
+[CloseSockSvr1]
+SocketServName=SockSvr1
\ No newline at end of file
--- a/datacommsserver/esockserver/test/TE_DummyProvider/configs/te_dummyproviders.cfg	Mon May 03 13:39:24 2010 +0300
+++ b/datacommsserver/esockserver/test/TE_DummyProvider/configs/te_dummyproviders.cfg	Fri May 14 14:12:43 2010 +0100
@@ -108,6 +108,33 @@
 	FIELD_COUNT=8
 END_ADD
 ## CASE005 END ##
+#############################################################
+## CASE006 BEGIN ##
+ADD_SECTION
+# COMMDB_ID = 7
+	Id=60
+	Name=DummyVanillaWithNextVanillaLayer
+	Tier=Link.TierTable.0x1028302B
+	MCpr=MCprTable.1
+	AccessPointSelectionPolicy=Link.APPrioritySelectionPolicyTable.4
+	Cpr=CprTable.2
+	SCpr=SCprTable.2
+	Protocol=ProtocolTable.1
+	FIELD_COUNT=8
+END_ADD
+
+ADD_SECTION
+# COMMDB_ID = 8
+	Id=61
+	Name=DummyVanillaWithNoNextLayer
+	Tier=Link.TierTable.0x1028302B
+	MCpr=MCprTable.1
+	Cpr=CprTable.2
+	SCpr=SCprTable.2
+	Protocol=ProtocolTable.1
+	FIELD_COUNT=7
+END_ADD
+## CASE005 END ##
 
 ############################################################
 ## APPrioritySelectionPolicyTable
@@ -115,7 +142,7 @@
 [APPrioritySelectionPolicyTable]
 ADD_SECTION
 # COMMDB_ID = 1
-    Id=1
+  Id=1
 	Name=SelectionPolicyCase001
 	AP1=Link.AccessPointTable.11
 	APCOUNT=1
@@ -124,7 +151,7 @@
 
 ADD_SECTION
 # COMMDB_ID = 2
-    Id=2
+  Id=2
 	Name=SelectionPolicyCase002
 	AP1=Link.AccessPointTable.21
 	APCOUNT=1
@@ -133,7 +160,7 @@
 
 ADD_SECTION
 # COMMDB_ID = 3
-    Id=3
+  Id=3
 	Name=SelectionPolicyCase003
 	AP1=Link.AccessPointTable.21
 	AP2=Link.AccessPointTable.11
@@ -141,6 +168,15 @@
 	FIELD_COUNT=5
 END_ADD
 
+ADD_SECTION
+# COMMDB_ID = 4
+  Id=4
+	Name=SelectionPolicyCase002
+	AP1=Link.AccessPointTable.61
+	APCOUNT=1
+	FIELD_COUNT=4
+END_ADD
+
 
 ############################################################
 ## TierTable
@@ -173,6 +209,9 @@
 ############################################################
 ## CprTable
 ## 
+# The cpr below is:
+# The corecpr with some of its activities overriden in order to test the production code executed by the
+# peers of the cpr. See code.
 [CprTable]
 ADD_SECTION
 # COMMDB_ID = 1
@@ -181,10 +220,23 @@
 	FIELD_COUNT=2
 END_ADD
 
+# The cpr below is:
+# The corecpr with local test activities designed to test the production code on the local node. 
+# It is important than that the production code (to be tested) is unpolluted by the test code.
+ADD_SECTION
+# COMMDB_ID = 2
+	Name=dummyvanillacpr
+	CprUid=0x10283030
+	FIELD_COUNT=2
+END_ADD
+
 ############################################################
 ## SCprTable
 ## 
 [SCprTable]
+# The scpr below is:
+# The corescpr with some of its activities overriden in order to test the production code executed by the
+# peers of the scpr. See code.
 ADD_SECTION
 # COMMDB_ID = 1
 	Name=dummyscpr
@@ -192,6 +244,16 @@
 	FIELD_COUNT=2
 END_ADD
 
+# The scpr below is:
+# The corescpr with local test activities designed to test the production code on the local node. 
+# It is important than that the production code (to be tested) is unpolluted by the test code.
+ADD_SECTION
+# COMMDB_ID = 2
+	Name=dummyscprvanilla
+	SCprUid=0x10283031
+	FIELD_COUNT=2
+END_ADD
+
 ############################################################
 ## ProtocolTable
 ## 
--- a/datacommsserver/esockserver/test/TE_DummyProvider/group/TE_DummyProvider.iby	Mon May 03 13:39:24 2010 +0300
+++ b/datacommsserver/esockserver/test/TE_DummyProvider/group/TE_DummyProvider.iby	Fri May 14 14:12:43 2010 +0100
@@ -26,6 +26,7 @@
 data=EPOCROOT##epoc32\data\z\TestData\scripts\te_dummyprovider_003.script TestData\scripts\te_dummyprovider_003.script
 data=EPOCROOT##epoc32\data\z\TestData\scripts\te_dummyprovider_004.script TestData\scripts\te_dummyprovider_004.script
 data=EPOCROOT##epoc32\data\z\TestData\scripts\te_dummyprovider_005.script TestData\scripts\te_dummyprovider_005.script
+data=EPOCROOT##epoc32\data\z\TestData\scripts\te_dummyprovider_006.script TestData\scripts\te_dummyprovider_006.script
 data=EPOCROOT##epoc32\data\z\TestData\scripts\te_dummyprovider_incomingSCPR.script TestData\scripts\te_dummyprovider_incomingSCPR.script
 
 data=EPOCROOT##epoc32\data\z\TestData\configs\te_dummyproviders.cfg TestData\configs\te_dummyproviders.cfg
@@ -34,6 +35,7 @@
 data=EPOCROOT##epoc32\data\z\TestData\configs\te_dummyprovider_003.ini TestData\configs\te_dummyprovider_003.ini
 data=EPOCROOT##epoc32\data\z\TestData\configs\te_dummyprovider_004.ini TestData\configs\te_dummyprovider_004.ini
 data=EPOCROOT##epoc32\data\z\TestData\configs\te_dummyprovider_005.ini TestData\configs\te_dummyprovider_005.ini
+data=EPOCROOT##epoc32\data\z\TestData\configs\te_dummyprovider_006.ini TestData\configs\te_dummyprovider_006.ini
 
 #endif // __TE_DummyProviders_IBY__
 
--- a/datacommsserver/esockserver/test/TE_DummyProvider/group/bld.inf	Mon May 03 13:39:24 2010 +0300
+++ b/datacommsserver/esockserver/test/TE_DummyProvider/group/bld.inf	Fri May 14 14:12:43 2010 +0100
@@ -27,12 +27,14 @@
 ../scripts/te_dummyprovider_003.script	z:/testdata/scripts/te_dummyprovider_003.script
 ../scripts/te_dummyprovider_004.script	z:/testdata/scripts/te_dummyprovider_004.script
 ../scripts/te_dummyprovider_005.script	z:/testdata/scripts/te_dummyprovider_005.script
+../scripts/te_dummyprovider_006.script	z:/testdata/scripts/te_dummyprovider_006.script
 
-../scripts/te_dummyprovider_incomingSCPR.script	z:/testdata/scripts/te_dummyprovider_incomingSCPR.script
+../scripts/te_dummyprovider_incomingSCPR.script	z:/testdata/scripts/te_dummyprovider_incomingscpr.script
 ../configs/te_dummyproviders.cfg	z:/testdata/configs/te_dummyproviders.cfg
 ../configs/te_dummyprovider_001.ini	z:/testdata/configs/te_dummyprovider_001.ini
 ../configs/te_dummyprovider_002.ini	z:/testdata/configs/te_dummyprovider_002.ini
 ../configs/te_dummyprovider_003.ini	z:/testdata/configs/te_dummyprovider_003.ini
 ../configs/te_dummyprovider_004.ini	z:/testdata/configs/te_dummyprovider_004.ini
 ../configs/te_dummyprovider_005.ini	z:/testdata/configs/te_dummyprovider_005.ini
+../configs/te_dummyprovider_006.ini	z:/testdata/configs/te_dummyprovider_006.ini
 
--- a/datacommsserver/esockserver/test/TE_DummyProvider/scripts/te_dummyprovider.script	Mon May 03 13:39:24 2010 +0300
+++ b/datacommsserver/esockserver/test/TE_DummyProvider/scripts/te_dummyprovider.script	Fri May 14 14:12:43 2010 +0100
@@ -31,6 +31,7 @@
 RUN_SCRIPT z:\testdata\scripts\te_dummyprovider_003.script
 RUN_SCRIPT z:\testdata\scripts\te_dummyprovider_004.script
 RUN_SCRIPT z:\testdata\scripts\te_dummyprovider_005.script
+RUN_SCRIPT z:\testdata\scripts\te_dummyprovider_006.script
 
 RUN_SCRIPT z:\testdata\scripts\te_esock_test_unloadesockForced.script
 RUN_SCRIPT z:\testdata\scripts\te_esock_test_remove_config_files.script
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/datacommsserver/esockserver/test/TE_DummyProvider/scripts/te_dummyprovider_006.script	Fri May 14 14:12:43 2010 +0100
@@ -0,0 +1,51 @@
+//
+// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+PRINT Running CASE001
+PRINT Two dummy vanilla layers starting successfully. 
+PRINT vanilla layers will test progressive cancel on a number of activities
+
+//
+LOAD_SUITE te_esockteststepsSuite -SharedData
+RUN_SCRIPT z:\TestData\scripts\te_esock_test_loadesock.script
+
+
+START_TESTCASE COMINF-ESOCK-DummyProviders-006
+//! @SYMTestCaseID COMINF-ESOCK-DummyProviders-006
+//! @SYMTestCaseDesc  Tests the resiliance of the TBindTo activity to progressive TCancel.
+//! @SYMTestActions   The app level starts an access point consisting of two dummy (corepr) layers. The layers (cpr and scpr) are modified to test the TBindTo activity using CancelTestBindToActivity
+//! @SYMTestExpectedResults    The access point is expected to start with success. The test case assumes the layers are armed (with CancelTestBindToActivity), but will do nothin to verify that progressive cancel took place.
+//! @SYMTestPriority  Critical 
+//! @SYMTestType CT
+//! @SYMComponent   comms-infras_esock
+
+RUN_TEST_STEP 100 te_esockteststepsSuite creatersocketservStep z:\testdata\configs\te_dummyprovider_006.ini CreateSockSvr1
+RUN_TEST_STEP 100 te_esockteststepsSuite createrconnectionStep z:\testdata\configs\te_dummyprovider_006.ini CreateConn1
+RUN_TEST_STEP 100 te_esockteststepsSuite connectrsocketservStep z:\testdata\configs\te_dummyprovider_006.ini ConnectSockSvr1
+RUN_TEST_STEP 100 te_esockteststepsSuite openrconnectionStep z:\testdata\configs\te_dummyprovider_006.ini OpenConn1
+RUN_TEST_STEP 100 te_esockteststepsSuite startrconnectionStep z:\testdata\configs\te_dummyprovider_006.ini StartConn1
+RUN_TEST_STEP 100 te_esockteststepsSuite stoprconnectionStep z:\testdata\configs\te_dummyprovider_006.ini StopConn1
+RUN_TEST_STEP 100 te_esockteststepsSuite closerconnectionStep z:\testdata\configs\te_dummyprovider_006.ini CloseConn1
+RUN_TEST_STEP 100 te_esockteststepsSuite closersocketservStep z:\testdata\configs\te_dummyprovider_006.ini CloseSockSvr1
+RUN_TEST_STEP 100 te_esockteststepsSuite cleanallStep
+END_TESTCASE COMINF-ESOCK-DummyProviders-006
+
+RUN_SCRIPT Z:\TestData\scripts\te_esock_test_unloadesockForced.script
+
+PRINT Completed CASE001
+
+END_TESTCASE  COMINF-ESOCK-DummyProviders-006
+
--- a/datacommsserver/esockserver/test/TE_EsockTestSteps/src/Connections.TestSteps.cpp	Mon May 03 13:39:24 2010 +0300
+++ b/datacommsserver/esockserver/test/TE_EsockTestSteps/src/Connections.TestSteps.cpp	Fri May 14 14:12:43 2010 +0100
@@ -952,8 +952,12 @@
 		}
 
 	TPtrC eventName;
-
-	if (GetStringFromConfig(iSection,KTe_SelectedProgress,eventName)==1)
+    TInt event;
+    if (GetIntFromConfig(iSection,KTe_SelectedProgress, event)==1)
+        {
+        iParams.iEventMask = event;
+        }
+    else if (GetStringFromConfig(iSection,KTe_SelectedProgress,eventName)==1)
 		{
 		if (eventName.Compare(KTe_LinkLayerOpen)==0)
 			{ iParams.iEventMask = KLinkLayerOpen; }
@@ -1009,8 +1013,12 @@
 		return KErrNotFound;
 
 	TPtrC eventName;
-
-	if (GetStringFromConfig(iSection,KTe_SelectedProgress,eventName)==1)
+    TInt event;
+    if (GetIntFromConfig(iSection,KTe_SelectedProgress, event)==1)
+        {
+        iParams.iEventMask = event;
+        }
+    else if (GetStringFromConfig(iSection,KTe_SelectedProgress,eventName)==1)
 		{
 		if (eventName.Compare(KTe_LinkLayerOpen)==0)
 			{ iParams.iEventMask = KLinkLayerOpen; }
@@ -1111,24 +1119,28 @@
 		return KErrNotFound;
 
 	TPtrC eventName;
-
-	if (GetStringFromConfig(iSection,KTe_SelectedProgress,eventName)==1)
-		{
-		if (eventName.Compare(KTe_LinkLayerOpen)==0)
-			{ iParams.iEventMask = KLinkLayerOpen; }
-		else if (eventName.Compare(KTe_LinkLayerClosed)==0)
-			{ iParams.iEventMask = KLinkLayerClosed; }
-		else
-			{
-			INFO_PRINTF3(_L("%S: Event type (%S) not recognised."),&iParams.iEventName,&eventName);
-			return KErrNotFound;
-			}
-		}
-	else
-		{
-		INFO_PRINTF1(_L("Event type missing."));
-		return KErrNotFound;
-		}
+	TInt event;
+	if (GetIntFromConfig(iSection,KTe_SelectedProgress, event)==1)
+	    {
+        iParams.iEventMask = event;
+	    }
+	else if (GetStringFromConfig(iSection,KTe_SelectedProgress,eventName)==1)
+	    {
+        if (eventName.Compare(KTe_LinkLayerOpen)==0)
+            { iParams.iEventMask = KLinkLayerOpen; }
+        else if (eventName.Compare(KTe_LinkLayerClosed)==0)
+            { iParams.iEventMask = KLinkLayerClosed; }
+        else
+            {
+            INFO_PRINTF3(_L("%S: Event type (%S) not recognised."),&iParams.iEventName,&eventName);
+            return KErrNotFound;
+            }
+        }
+    else
+        {
+        INFO_PRINTF1(_L("Event type missing."));
+        return KErrNotFound;
+        }	
 
 	if (!GetIntFromConfig(iSection, KExpectedError, iExpectedError))
 		{
@@ -1157,18 +1169,17 @@
 	TNifProgress* event = NULL;
 	TInt err = iEsockTest->ReceiveProgressNotificationEvent(event, iParams.iEventName, iParams.iTimeoutMiliSecs);
 
-	if (event == NULL || err == KErrNone)
+	if (event == NULL && err == KErrNone)
 		{
 		INFO_PRINTF2(_L("%S: Did not receive any event."),&iParams.iEventName);
-
 		return EPass;
 		}
-		else if (event == NULL || err != KErrNone)
-		{
-		INFO_PRINTF2(_L("%S: Did not receive any event but error condiction detected !"),&iParams.iEventName);
-		INFO_PRINTF2(_L("The error code returned was %d."),err);
-		return EFail;
-		}
+    else if (event == NULL || err != KErrNone)
+        {
+        INFO_PRINTF2(_L("%S: Did not receive any event but error condiction detected !"),&iParams.iEventName);
+        INFO_PRINTF2(_L("The error code returned was %d."),err);
+        return EFail;
+        }
 
 
 	TInt eventId = event->iStage;
--- a/datacommsserver/esockserver/test/TE_EsockTestSteps/src/EsockTestBase.cpp	Mon May 03 13:39:24 2010 +0300
+++ b/datacommsserver/esockserver/test/TE_EsockTestSteps/src/EsockTestBase.cpp	Fri May 14 14:12:43 2010 +0100
@@ -1483,7 +1483,7 @@
 	    User::WaitForRequest(ec->iEventReceived);
 	    }
 	aNifProgress = (ec->iEventReceived.Int()==KErrNone)? &ec->iProgressBuf() : NULL;
-	return ec->iEventReceived.Int();
+	return ec->iEventReceived.Int() == KRequestPending ? KErrNone : ec->iEventReceived.Int();
 	}
 
 
--- a/datacommsserver/esockserver/test/TE_RConnection/configs/Mobility/Mobility_760640.ini	Mon May 03 13:39:24 2010 +0300
+++ b/datacommsserver/esockserver/test/TE_RConnection/configs/Mobility/Mobility_760640.ini	Fri May 14 14:12:43 2010 +0100
@@ -44,6 +44,16 @@
 Expected0NewAP=5
 Expected0OldAP=4
 
+[ProgressNotificationEvent1]
+ConnEventsName=Conn1Events
+ConnName=Conn1
+SelectedProgress=4500
+
+[CheckNegativeProgressNotificationEvent1]
+ConnEventsName=Conn1Events
+SelectedProgress=4500
+TimeoutInMilliSeconds=11000
+
 [MigrateToPreferredCarrier]
 MobilityExtName=MobExt1
 
--- a/datacommsserver/esockserver/test/TE_RConnection/scripts/Mobility/Mobility_760640.script	Mon May 03 13:39:24 2010 +0300
+++ b/datacommsserver/esockserver/test/TE_RConnection/scripts/Mobility/Mobility_760640.script	Fri May 14 14:12:43 2010 +0100
@@ -24,6 +24,7 @@
 PRINT Receive PreferredCarierAvailable
 PRINT Do not register (no call to RCommsMobilityApiExt::RegisterForMobilityNotification()),
 PRINT RCommsMobilityApiExt::MigrateToPreferredCarrier(),
+PRINT Check to see if the progresses from the abanonded AP don't perculate to the app.
 PRINT RCommsMobilityApiExt::Close()
 
 // Load the test suite
@@ -75,6 +76,11 @@
 //Migrate to preferred carrier
 RUN_TEST_STEP 150 te_esockteststepsSuite migratercommsmobilityapiextStep z:\testdata\configs\BearerMobility\Mobility_760640.ini MigrateToPreferredCarrier
 
+//Check absence of progress from the abandoned IAP4
+RUN_TEST_STEP 100 te_esockteststepsSuite RegisterProgressNotificationStep    z:\testdata\configs\BearerMobility\Mobility_760640.ini ProgressNotificationEvent1
+RUN_TEST_STEP 100 te_esockteststepsSuite CheckNegativeProgressNotificationStep z:\testdata\configs\BearerMobility\Mobility_760640.ini CheckNegativeProgressNotificationEvent1
+
+
 // Clean up what we used
 RUN_TEST_STEP 150 te_esockteststepsSuite CloseRCommsMobilityAPIExtStep z:\testdata\configs\BearerMobility\Mobility_760640.ini CloseMobilityExtension
 RUN_TEST_STEP 150 te_esockteststepsSuite CloseRConnectionStep z:\testdata\configs\BearerMobility\Mobility_760640.ini CloseConn
--- a/datacommsserver/esockserver/test/providers/dummy/group/dummypr.mmp	Mon May 03 13:39:24 2010 +0300
+++ b/datacommsserver/esockserver/test/providers/dummy/group/dummypr.mmp	Fri May 14 14:12:43 2010 +0100
@@ -35,7 +35,8 @@
 SOURCE			dummypr_mcprpubsubsubscriber.cpp
 SOURCE			dummypr_metaconnprov.cpp
 SOURCE			dummypr_tiermanager.cpp
-SOURCE			dummypr_network_flow.cpp
+SOURCE			dummypr_network_flow.cpp 
+SOURCE			activityTest.cpp
 
 
 USERINCLUDE     ../inc
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/datacommsserver/esockserver/test/providers/dummy/inc/activityTest.h	Fri May 14 14:12:43 2010 +0100
@@ -0,0 +1,142 @@
+// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalTechnology
+*/
+
+#include <elements/mm_states.h>
+#include <ss_internal_activities.h>
+
+#ifndef SYMBIAN_ACTIVITYTEST
+#define SYMBIAN_ACTIVITYTEST
+
+namespace CancelTestBindToActivity
+    {
+    DECLARE_NODEACTIVITY(CancelBindTo)
+    }
+
+class CActivityCancelTest : public MeshMachine::CNodeRetryActivity
+                                      
+/**
+@internalTechnology
+*/
+    {
+public:
+    //TODO
+    enum {ECancelTestActivity = ESock::ECFActivityBuildStack };
+    static MeshMachine::CNodeActivityBase* NewL(const MeshMachine::TNodeActivity& aActivitySig, MeshMachine::AMMNodeBase& aNode)
+        {
+        CActivityCancelTest* self = new (ELeave) CActivityCancelTest(aActivitySig, aNode);
+        return self;
+        }
+
+    class TProgressiveMutex
+        {
+        public:
+        static TBool IsBlocked(MeshMachine::TNodeContextBase& aContext)
+            {
+            return static_cast<CActivityCancelTest&>(*aContext.iNodeActivity).ProgressiveMutex();
+            }
+        };
+    
+    void NextLoop()
+        {
+        iMaxLoopCount++;
+        iCurrentLoopCount = 0;        
+        }
+    
+    TBool ProgressiveMutex()
+        {
+        return ++iCurrentLoopCount <= iMaxLoopCount;
+        }
+    
+protected:
+    CActivityCancelTest(const MeshMachine::TNodeActivity& aActivitySig, MeshMachine::AMMNodeBase& aNode)
+    :   CNodeRetryActivity(aActivitySig, aNode)
+        {
+        }
+    
+    void StoreRequestL(const Messages::TSignatureBase& aRequest);
+    const Messages::TSignatureBase& StoredRequest()
+        { 
+        return *reinterpret_cast<const Messages::TSignatureBase*>(iStoredRequest.Ptr()); 
+        }
+    
+    
+private:
+    TBuf8<__Align8(Messages::TSignalBase::KMaxInlineMessageSize + Messages::TSignalBase::KMaxUnstoredOverhead)> iStoredRequest;
+    TInt iMaxLoopCount;
+    TInt iCurrentLoopCount;
+    
+public:
+    typedef MeshMachine::TContext TContext;
+    
+    template<typename TMESSAGE>
+    class TAwaitingMessageState : public MeshMachine::TState<TContext>
+        {
+    public:
+        NETSM_TPL_DECLARE_CTR(TAwaitingMessageState, NetStateMachine::MState, TContext)
+
+        explicit TAwaitingMessageState(TContext& aContext) :
+            MeshMachine::TState<TContext>(aContext) {}
+
+        virtual TBool Accept()
+                {
+    #ifdef __GCCXML__
+                return EFalse;
+    #else
+                if (Messages::address_cast<const Messages::TNodeCtxId>(iContext.iSender).NodeCtx() != CActivityCancelTest::ECancelTestActivity)
+                    {
+                    Messages::TNodeSignal& msg = this->iContext.iMessage; //Arm compiler is getting confused otherwise
+                    return msg.IsMessage<TMESSAGE>();
+                    }
+    #endif
+                return EFalse;                
+                }
+        };  
+
+    DECLARE_SMELEMENT_HEADER( TNoTagForwardOrActiveTagBackward, MeshMachine::TStateFork<TContext>, NetStateMachine::MStateFork, TContext )
+        virtual TInt TransitionTag();
+    DECLARE_SMELEMENT_FOOTER( TNoTagForwardOrActiveTagBackward )    
+    
+    DECLARE_SMELEMENT_HEADER( TBeginTest, MeshMachine::TStateTransition<TContext>, NetStateMachine::MStateTransition, TContext )
+        virtual void DoL();
+    DECLARE_SMELEMENT_FOOTER( TBeginTest )
+    
+    DECLARE_SMELEMENT_HEADER( TBeginLoop, MeshMachine::TStateTransition<TContext>, NetStateMachine::MStateTransition, TContext )
+        virtual void DoL();
+    DECLARE_SMELEMENT_FOOTER( TBeginLoop )    
+
+    DECLARE_SMELEMENT_HEADER( TCancel, MeshMachine::TStateTransition<TContext>, NetStateMachine::MStateTransition, TContext )
+        virtual void DoL();
+    DECLARE_SMELEMENT_FOOTER( TCancel )
+
+    DECLARE_SMELEMENT_HEADER( TEndTest, MeshMachine::TStateTransition<TContext>, NetStateMachine::MStateTransition, TContext )
+        virtual void DoL();
+    DECLARE_SMELEMENT_FOOTER( TEndTest )
+    
+    DECLARE_SERIALIZABLE_TRANSITION(
+        TProgressiveCancel,
+        TProgressiveMutex,
+        TCancel
+        )      
+    };
+
+
+#endif //SYMBIAN_ACTIVITYTEST
+
+
--- a/datacommsserver/esockserver/test/providers/dummy/inc/dummypr_connprov.h	Mon May 03 13:39:24 2010 +0300
+++ b/datacommsserver/esockserver/test/providers/dummy/inc/dummypr_connprov.h	Fri May 14 14:12:43 2010 +0100
@@ -59,7 +59,10 @@
          };
 
     static CDummyConnectionProvider* NewL(ESock::CConnectionProviderFactoryBase& aFactory, TConnType aConnStatus);
-    CDummyConnectionProvider(ESock::CConnectionProviderFactoryBase& aFactory, TConnType aConnStatus);
+    static CDummyConnectionProvider* NewVanillaL(ESock::CConnectionProviderFactoryBase& aFactory);
+    
+    CDummyConnectionProvider(ESock::CConnectionProviderFactoryBase& aFactory, const MeshMachine::TNodeActivityMap& aActivityMap, TConnType aConnStatus);
+    
 public:
 	TConnType iConnStatus;
     };
--- a/datacommsserver/esockserver/test/providers/dummy/inc/dummypr_factory.h	Mon May 03 13:39:24 2010 +0300
+++ b/datacommsserver/esockserver/test/providers/dummy/inc/dummypr_factory.h	Fri May 14 14:12:43 2010 +0100
@@ -30,6 +30,9 @@
 #include <comms-infras/ss_connprov.h>
 #include <comms-infras/ss_tiermanager.h>
 #include <comms-infras/ss_nodemessages.h>
+
+using namespace ESock;
+
 //-=========================================================
 //
 // CDummyTierManagerFactory
@@ -88,6 +91,17 @@
 	CDummyHangingConnectionProviderFactory(TUid aFactoryId, ESock::CConnectionFactoryContainer& aParentContainer);
 	virtual ESock::ACommsFactoryNodeId* DoCreateObjectL(ESock::TFactoryQueryBase& aQuery);
 	};
+
+class CDummyVanillaConnectionProviderFactory : public ESock::CConnectionProviderFactoryBase
+    {
+public:
+    enum { iUid = 0x10283030 };
+    static CDummyVanillaConnectionProviderFactory* NewL(TAny* aParentContainer);
+
+protected:
+    CDummyVanillaConnectionProviderFactory(TUid aFactoryId, ESock::CConnectionFactoryContainer& aParentContainer);
+    virtual ESock::ACommsFactoryNodeId* DoCreateObjectL(ESock::TFactoryQueryBase& aQuery);
+    };
 	
 //-=========================================================
 //
@@ -111,8 +125,6 @@
 // CDummyExtendedSubConnectionProviderFactory
 //
 //-=========================================================
-namespace ESock
-{
 class CDummyExtendedSubConnectionProviderFactory : public ESock::CSubConnectionProviderFactoryBase
 	{
 public:
@@ -123,15 +135,31 @@
 	CDummyExtendedSubConnectionProviderFactory(TUid aFactoryId, ESock::CSubConnectionFactoryContainer& aParentContainer);
 	virtual ESock::ACommsFactoryNodeId* DoCreateObjectL(ESock::TFactoryQueryBase& aQuery);
 	};
-}
+
+
+//-=========================================================
+//
+// CDummyVanillaSubConnectionProviderFactory
+//
+//-=========================================================
+class CDummyVanillaSubConnectionProviderFactory : public ESock::CSubConnectionProviderFactoryBase
+    {
+public:
+    enum { iUid = 0x10283031 };
+    static CDummyVanillaSubConnectionProviderFactory* NewL(TAny* aParentContainer);
+
+protected:
+    CDummyVanillaSubConnectionProviderFactory(TUid aFactoryId, ESock::CSubConnectionFactoryContainer& aParentContainer);
+    virtual ESock::ACommsFactoryNodeId* DoCreateObjectL(ESock::TFactoryQueryBase& aQuery);
+    };
+
+
 
 //-=========================================================
 //
 // CDummyNetworkFlowFactory
 //
 //-=========================================================
-namespace ESock
-{
 class CDummyNetworkFlowFactory : public ESock::CSubConnectionFlowFactoryBase
 	{
 public:
@@ -147,7 +175,6 @@
 	virtual ESock::ACommsFactoryNodeId* DoFindOrCreateObjectL(ESock::TFactoryQueryBase& aQuery);
 	virtual TServerProtocolDesc* DoCreateFlowDescriptionL(TInt aProtocol);
 	};
-}
 
 
 #endif	// __DummyPR_FACTORY_H__
--- a/datacommsserver/esockserver/test/providers/dummy/inc/dummypr_subconnprov.h	Mon May 03 13:39:24 2010 +0300
+++ b/datacommsserver/esockserver/test/providers/dummy/inc/dummypr_subconnprov.h	Fri May 14 14:12:43 2010 +0100
@@ -30,6 +30,7 @@
 #include <comms-infras/ss_corepractivities.h>
 
 class CDummySubConnectionProviderFactory;
+class CDummyVanillaSubConnectionProviderFactory;
 
 //-================================================
 //
@@ -49,24 +50,22 @@
 }
 
 
-namespace ESock
-{
-	/* We have to have CDummySubConnectionProvider inside the ESock namespace so it can befriend
-	mcfnode_cast - GCC simply doesn't allow befriending something in another template. See
-	http://gcc.gnu.org/ml/gcc-prs/2002-10/msg01010.html for Herb Sutter's GOTW column on exactly
-	this - it contains this discouraging summary:
+
+/* We have to have CDummySubConnectionProvider inside the ESock namespace so it can befriend
+mcfnode_cast - GCC simply doesn't allow befriending something in another template. See
+http://gcc.gnu.org/ml/gcc-prs/2002-10/msg01010.html for Herb Sutter's GOTW column on exactly
+this - it contains this discouraging summary:
 
-	The reason that I'm writing an article about it is because, alas,
-	befriending a template in another namespace is easier said than done:
-
-   	- The Bad News: There are two perfectly good standards-conforming
-     ways to do it, and neither one works on all current compilers.
+The reason that I'm writing an article about it is because, alas,
+befriending a template in another namespace is easier said than done:
 
-   	- The Good News: One of the perfectly good standards-conforming ways
-     does work on every current compiler I tried except for gcc.
+- The Bad News: There are two perfectly good standards-conforming
+ ways to do it, and neither one works on all current compilers.
 
-	So, since it's only test code & we need it building on GCC, I've hacked around it */
+- The Good News: One of the perfectly good standards-conforming ways
+ does work on every current compiler I tried except for gcc.
 
+So, since it's only test code & we need it building on GCC, I've hacked around it */
 class CDummySubConnectionProvider : public CCoreSubConnectionProvider
 /**
 
@@ -85,7 +84,8 @@
     friend CDummySubConnectionProvider* Messages::mnode_cast<CDummySubConnectionProvider>(ANode* aNode);
     friend CDummySubConnectionProvider& Messages::mnode_cast<CDummySubConnectionProvider>(ANode& aNode);
 #endif
-    friend class ::CDummySubConnectionProviderFactory;
+    friend class CDummySubConnectionProviderFactory;
+    friend class CDummyVanillaSubConnectionProviderFactory;
     friend class DummySCPRStates::TRaiseGranted;
 
 public:
@@ -94,11 +94,15 @@
 
 protected:
     static CDummySubConnectionProvider* NewL(ESock::CSubConnectionProviderFactoryBase& aFactory);
-    CDummySubConnectionProvider(ESock::CSubConnectionProviderFactoryBase& aFactory);
+    static CDummySubConnectionProvider* NewVanillaL(ESock::CSubConnectionProviderFactoryBase& aFactory);
+    
+    CDummySubConnectionProvider(ESock::CSubConnectionProviderFactoryBase& aFactory, const MeshMachine::TNodeActivityMap& aActivityMap);
 
 private:
     TBool incomingStatus;
 	};
+
+
 class CDummyExtendedSubConnectionProvider : public CCoreSubConnectionProvider
 /**
 This dummy is intended to create flow shim based layer beneath it during its own creation
@@ -134,13 +138,13 @@
 
 private:
     TBool incomingStatus;
-    TFlowParams iFlowParams;
+    ESock::TFlowParams iFlowParams;
 	};
-}
+
 
 namespace DummySCPRStates
 {
-typedef MeshMachine::TNodeContext<ESock::CDummySubConnectionProvider, SCprStates::TContext> TContext;
+typedef MeshMachine::TNodeContext<CDummySubConnectionProvider, SCprStates::TContext> TContext;
 
 DECLARE_SMELEMENT_HEADER( TRaiseGranted, MeshMachine::TStateTransition<TContext>, NetStateMachine::MStateTransition, DummySCPRStates::TContext )
 	virtual void DoL();
@@ -159,7 +163,7 @@
 
 namespace DummyExtendedSCPRStates
 {
-typedef MeshMachine::TNodeContext<ESock::CDummyExtendedSubConnectionProvider, SCprStates::TContext> TContext;
+typedef MeshMachine::TNodeContext<CDummyExtendedSubConnectionProvider, SCprStates::TContext> TContext;
 
 DECLARE_SMELEMENT_HEADER( TAwaitingBinderResponse, MeshMachine::TState<TContext>, NetStateMachine::MState, TContext )
 	virtual TBool Accept();
@@ -219,7 +223,7 @@
 			}
 		iFlowParameters.Open(aFlowParameters);
 		}
-	typedef MeshMachine::TNodeContext<ESock::CDummyExtendedSubConnectionProvider, SCprStates::TContext> TContext;
+	typedef MeshMachine::TNodeContext<CDummyExtendedSubConnectionProvider, SCprStates::TContext> TContext;
 
 	static MeshMachine::CNodeActivityBase* CDummyBuildStackActivity::NewL( const MeshMachine::TNodeActivity& aActivitySig, MeshMachine::AMMNodeBase& aNode );
 
--- a/datacommsserver/esockserver/test/providers/dummy/src/1028302A.rss	Mon May 03 13:39:24 2010 +0300
+++ b/datacommsserver/esockserver/test/providers/dummy/src/1028302A.rss	Fri May 14 14:12:43 2010 +0100
@@ -89,6 +89,21 @@
         },
     INTERFACE_INFO
         {
+        interface_uid =  0x102070EE;
+        implementations = 
+            {
+           IMPLEMENTATION_INFO
+                {
+                implementation_uid = 0x10283030;
+                version_no = 1;
+                display_name = "Dummy Vanilla Connection Provider Factory";
+                default_data = "DummyVanillaConnectionProviderFactory";
+                opaque_data = "";
+                }
+            };
+        },        
+    INTERFACE_INFO
+        {
         interface_uid = 0x10204301;
         implementations = 
             {
@@ -116,7 +131,22 @@
                 opaque_data = "";
                 }
             };
-        },    
+        },   
+    INTERFACE_INFO
+        {
+        interface_uid = 0x10204301;
+        implementations = 
+            {
+           IMPLEMENTATION_INFO
+                {
+                implementation_uid = 0x10283031;
+                version_no = 1;
+                display_name = "Dummy Vanilla SCPR Factory";
+                default_data = "DummyVanillaSCPRFactory";
+                opaque_data = "";
+                }
+            };
+        },            
     INTERFACE_INFO
         {
         interface_uid = 0x10281C33;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/datacommsserver/esockserver/test/providers/dummy/src/activityTest.cpp	Fri May 14 14:12:43 2010 +0100
@@ -0,0 +1,121 @@
+// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// TestDummy implementation file for a TierManager
+// 
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#include <elements/nm_messages_base.h>
+#include <comms-infras/ss_nodemessages_dataclient.h>
+#include <ss_glob.h>
+#include "activityTest.h"
+
+using namespace Messages;
+using namespace MeshMachine;
+using namespace ESock;
+
+void CActivityCancelTest::StoreRequestL(const TSignatureBase& aRequest)
+    {
+    TBuf8<__Align8(TSignalBase::KMaxInlineMessageSize + TSignalBase::KMaxUnstoredOverhead)> msgBuf;
+    aRequest.Store(msgBuf);
+    TPtrC8 messageStore(msgBuf);
+    TlsGlobals::Get().VirtualCtor()->New(messageStore, iStoredRequest);
+    }
+
+
+DEFINE_SMELEMENT(CActivityCancelTest::TNoTagForwardOrActiveTagBackward, NetStateMachine::MStateFork, TContext)
+TInt CActivityCancelTest::TNoTagForwardOrActiveTagBackward::TransitionTag()
+    {
+    if (message_cast<TEBase::TError>(&iContext.iMessage))
+        {
+        return KActiveTag | NetStateMachine::EBackward;
+        }
+    return KNoTag | NetStateMachine::EForward;
+    }
+
+DEFINE_SMELEMENT(CActivityCancelTest::TBeginTest, NetStateMachine::MStateTransition, TContext)
+void CActivityCancelTest::TBeginTest::DoL()
+    {
+    ASSERT(iContext.iNodeActivity);
+    CActivityCancelTest& act = static_cast<CActivityCancelTest&>(*iContext.iNodeActivity);
+    act.StoreRequestL(iContext.iMessage);
+    }
+    
+DEFINE_SMELEMENT(CActivityCancelTest::TBeginLoop, NetStateMachine::MStateTransition, TContext)
+void CActivityCancelTest::TBeginLoop::DoL()
+    {
+    ASSERT(iContext.iNodeActivity);
+    CActivityCancelTest& act = static_cast<CActivityCancelTest&>(*iContext.iNodeActivity);    
+    act.PostRequestTo(iContext.Node().Id(), act.StoredRequest());  
+    act.NextLoop();
+    }
+
+
+DEFINE_SMELEMENT(CActivityCancelTest::TCancel, NetStateMachine::MStateTransition, TContext)
+void CActivityCancelTest::TCancel::DoL()
+    {
+    ASSERT(iContext.iNodeActivity);
+    CActivityCancelTest& act = static_cast<CActivityCancelTest&>(*iContext.iNodeActivity);    
+    act.PostRequestTo(iContext.Node().Id(), TEBase::TCancel());
+    }
+
+DEFINE_SMELEMENT(CActivityCancelTest::TEndTest, NetStateMachine::MStateTransition, TContext)
+void CActivityCancelTest::TEndTest::DoL()
+    {
+    ASSERT(iContext.iNodeActivity);
+    CActivityCancelTest& act = static_cast<CActivityCancelTest&>(*iContext.iNodeActivity);   
+    act.PostToOriginators(iContext.iMessage);
+    ASSERT(act.Error() != KErrNone); //if the activity has done its job, the activity have been invariably errored; 
+    act.SetError(KErrNone); //No point reporting this error though.
+    }
+
+
+namespace CancelTestBindToActivity
+{
+/* This is a largely generic activity written to test cancelling behaviour of another (typically 
+ * production code) activity. In this case it is put on top of and to test the TBindTo 
+ * activity, by the virtue of awaiting TCFDataClient::TBindTo. In principle though it can be put on
+ * top of any other activity by awaiting for something else instead. CancelTestBindToActivity hijacks
+ * and stores the original request (in this case TCFDataClient::TBindTo). It then goes to perform a 
+ * loop:
+ * { 
+ * - It forwards the stored request to the overriden activity (in this case the TBindTo activity), 
+ * - then follows it with a TCancel 
+ * - and awaits for TError. 
+ * }
+ * Each loop will send the TCancel slightly later, i.e.: at consecutive ticks triggered by messages 
+ * received by the local node (and subsequently resulting in AMMNodeBase::SignalActivities). 
+ * If you examine CActivityCancelTest::TProgressiveCancel you will see that it is blocked 
+ * (as any other synchronised activity) against gradually increasing number of ticks. It has been
+ * pointed out that the tick resolution may be too small - i.e.: that we may want to tick the
+ * activity with every message sent within the local thread (and thus with every even that can
+ * change the state of the activity peers). This can be done by signalling CActivityCancelTest
+ * from the transport upon every dispatch (or post). This is so far not done. Instead CancelTestBindToActivity
+ * is put against every mm node performing bind to (CPR and SCPR).
+ */
+DEFINE_CUSTOM_NODEACTIVITY(CActivityCancelTest::ECancelTestActivity, CancelBindTo, TCFDataClient::TBindTo, CActivityCancelTest::NewL)
+    FIRST_NODEACTIVITY_ENTRY(CActivityCancelTest::TAwaitingMessageState<TCFDataClient::TBindTo>, MeshMachine::TNoTag)
+    THROUGH_NODEACTIVITY_ENTRY(KNoTag, CActivityCancelTest::TBeginTest, MeshMachine::TTag<KActiveTag>)
+    THROUGH_NODEACTIVITY_ENTRY(KActiveTag, CActivityCancelTest::TBeginLoop, MeshMachine::TNoTag)    
+    NODEACTIVITY_ENTRY(KNoTag, CActivityCancelTest::TProgressiveCancel, MeshMachine::TAcceptErrorState<MeshMachine::TAwaitingMessageState<TCFDataClient::TBindToComplete>  >, CActivityCancelTest::TNoTagForwardOrActiveTagBackward)
+    LAST_NODEACTIVITY_ENTRY(KNoTag, CActivityCancelTest::TEndTest)
+NODEACTIVITY_END()
+}
+
+
+
--- a/datacommsserver/esockserver/test/providers/dummy/src/dummypr_connprov.cpp	Mon May 03 13:39:24 2010 +0300
+++ b/datacommsserver/esockserver/test/providers/dummy/src/dummypr_connprov.cpp	Fri May 14 14:12:43 2010 +0100
@@ -27,6 +27,7 @@
 #include "dummypr_metaconnprov.h"
 #include "dummypr_connprov.h"
 #include "dummypr_subconnprov.h"
+#include "activityTest.h"
 
 #include <elements/sd_mintercept.h>
 
@@ -136,7 +137,7 @@
 NODEACTIVITY_END()
 }
 
-// Activity Map
+// Activity Map For test-code ridden cpr
 namespace DummyCPRStates
 {
 DECLARE_DEFINE_ACTIVITY_MAP(stateMap)
@@ -145,9 +146,26 @@
 ACTIVITY_MAP_END_BASE(MobilityCprActivities, mobilityCprActivities)
 }
 
+// Activity Map For vanilla cpr
+namespace VanillaDummyCPRStates
+{
+DECLARE_DEFINE_ACTIVITY_MAP(stateMap)
+   ACTIVITY_MAP_ENTRY(CancelTestBindToActivity, CancelBindTo)   
+ACTIVITY_MAP_END_BASE(MobilityCprActivities, mobilityCprActivities)
+}
+
 CDummyConnectionProvider* CDummyConnectionProvider::NewL(ESock::CConnectionProviderFactoryBase& aFactory, TConnType aConnStatus)
     {
-    CDummyConnectionProvider* self = new (ELeave) CDummyConnectionProvider(aFactory, aConnStatus);
+    CDummyConnectionProvider* self = new (ELeave) CDummyConnectionProvider(aFactory, DummyCPRStates::stateMap::Self(), aConnStatus);
+    CleanupStack::PushL(self);
+    self->ConstructL(KDummyCPRPreallocatedActivityBufferSize);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+CDummyConnectionProvider* CDummyConnectionProvider::NewVanillaL(ESock::CConnectionProviderFactoryBase& aFactory)
+    {
+    CDummyConnectionProvider* self = new (ELeave) CDummyConnectionProvider(aFactory, VanillaDummyCPRStates::stateMap::Self(), CDummyConnectionProvider::EConnNoIncoming);
     CleanupStack::PushL(self);
     self->ConstructL(KDummyCPRPreallocatedActivityBufferSize);
     CleanupStack::Pop(self);
@@ -155,8 +173,8 @@
     }
 
 
-CDummyConnectionProvider::CDummyConnectionProvider(CConnectionProviderFactoryBase& aFactory, TConnType aConnStatus)
-:	CMobilityConnectionProvider(aFactory, DummyCPRStates::stateMap::Self()),
+CDummyConnectionProvider::CDummyConnectionProvider(CConnectionProviderFactoryBase& aFactory, const MeshMachine::TNodeActivityMap& aActivityMap, TConnType aConnStatus)
+:	CMobilityConnectionProvider(aFactory, aActivityMap),
 	TIfStaticFetcherNearestInHierarchy(this),
     iConnStatus(aConnStatus)
 	{
@@ -189,3 +207,5 @@
 
 
 
+
+
--- a/datacommsserver/esockserver/test/providers/dummy/src/dummypr_factory.cpp	Mon May 03 13:39:24 2010 +0300
+++ b/datacommsserver/esockserver/test/providers/dummy/src/dummypr_factory.cpp	Fri May 14 14:12:43 2010 +0100
@@ -61,8 +61,10 @@
 	IMPLEMENTATION_PROXY_ENTRY(CDummyTierManagerFactory::iUid, CDummyTierManagerFactory::NewL),
 	IMPLEMENTATION_PROXY_ENTRY(CDummyMetaConnectionProviderFactory::iUid, CDummyMetaConnectionProviderFactory::NewL),
 	IMPLEMENTATION_PROXY_ENTRY(CDummyConnectionProviderFactory::iUid, CDummyConnectionProviderFactory::NewL),
-	IMPLEMENTATION_PROXY_ENTRY(CDummyHangingConnectionProviderFactory::iUid, CDummyHangingConnectionProviderFactory::NewL),	
+	IMPLEMENTATION_PROXY_ENTRY(CDummyHangingConnectionProviderFactory::iUid, CDummyHangingConnectionProviderFactory::NewL),
+    IMPLEMENTATION_PROXY_ENTRY(CDummyVanillaConnectionProviderFactory::iUid, CDummyVanillaConnectionProviderFactory::NewL), 	
 	IMPLEMENTATION_PROXY_ENTRY(CDummySubConnectionProviderFactory::iUid, CDummySubConnectionProviderFactory::NewL),
+    IMPLEMENTATION_PROXY_ENTRY(CDummyVanillaSubConnectionProviderFactory::iUid, CDummyVanillaSubConnectionProviderFactory::NewL),	
 	IMPLEMENTATION_PROXY_ENTRY(CDummyExtendedSubConnectionProviderFactory::iUid, CDummyExtendedSubConnectionProviderFactory::NewL),
 
 	// Flow and flow description
@@ -166,6 +168,26 @@
     return provider;
     }
 
+CDummyVanillaConnectionProviderFactory* CDummyVanillaConnectionProviderFactory::NewL(TAny* aParentContainer)
+    {
+    return new (ELeave) CDummyVanillaConnectionProviderFactory(TUid::Uid(CDummyVanillaConnectionProviderFactory::iUid), *reinterpret_cast<ESock::CConnectionFactoryContainer*>(aParentContainer));
+    }
+    
+CDummyVanillaConnectionProviderFactory::CDummyVanillaConnectionProviderFactory(TUid aFactoryId, ESock::CConnectionFactoryContainer& aParentContainer)
+    : ESock::CConnectionProviderFactoryBase(aFactoryId, aParentContainer)
+    {
+    //LOG_NODE_CREATE(KDummyCPRTag, CDummyHangingConnectionProviderFactory);
+    }
+
+ACommsFactoryNodeId* CDummyVanillaConnectionProviderFactory::DoCreateObjectL(TFactoryQueryBase& /* aQuery */)
+    {    
+    CConnectionProviderBase* provider = CDummyConnectionProvider::NewVanillaL(*this );
+    
+    ESOCK_DEBUG_REGISTER_GENERAL_NODE(iUid, provider);
+
+    return provider;
+    }
+
 //-=========================================================
 //
 // CDummySubConnectionProviderFactory methods
@@ -209,8 +231,7 @@
 // CDummyExtendedSubConnectionProviderFactory methods
 //
 //-=========================================================	
-namespace ESock
-{
+
 CDummyExtendedSubConnectionProviderFactory* CDummyExtendedSubConnectionProviderFactory::NewL(TAny* aParentContainer)
     {
     return new (ELeave) CDummyExtendedSubConnectionProviderFactory(TUid::Uid(CDummyExtendedSubConnectionProviderFactory::iUid), 
@@ -230,7 +251,7 @@
 
     if ((query.iSCPRType == RSubConnection::EAttachToDefault) || (query.iSCPRType == RSubConnection::ECreateNew))
         {
-        provider = ESock::CDummyExtendedSubConnectionProvider::NewL(*this);
+        provider = CDummyExtendedSubConnectionProvider::NewL(*this);
 		ESOCK_DEBUG_REGISTER_GENERAL_NODE(iUid, provider);
         }
     else
@@ -239,15 +260,48 @@
         }
     return provider;
     }
-}
+
+
+
+//-=========================================================
+//
+// CDummyExtendedSubConnectionProviderFactory methods
+//
+//-=========================================================    
+CDummyVanillaSubConnectionProviderFactory* CDummyVanillaSubConnectionProviderFactory::NewL(TAny* aParentContainer)
+    {
+    return new (ELeave) CDummyVanillaSubConnectionProviderFactory(TUid::Uid(CDummyVanillaSubConnectionProviderFactory::iUid), 
+                                            *reinterpret_cast<ESock::CSubConnectionFactoryContainer*>(aParentContainer));
+    }
+    
+CDummyVanillaSubConnectionProviderFactory::CDummyVanillaSubConnectionProviderFactory(TUid aFactoryId, ESock::CSubConnectionFactoryContainer& aParentContainer)
+    : CSubConnectionProviderFactoryBase(aFactoryId, aParentContainer)
+    {
+    //LOG_NODE_CREATE(KDummyExtendedSCPRTag, CDummyExtendedSubConnectionProviderFactory);
+    }
+
+ACommsFactoryNodeId* CDummyVanillaSubConnectionProviderFactory::DoCreateObjectL(TFactoryQueryBase& aQuery)
+    {
+    const TDefaultSCPRFactoryQuery& query = static_cast<const TDefaultSCPRFactoryQuery&>(aQuery);    
+    CSubConnectionProviderBase* provider = NULL;
+
+    if ((query.iSCPRType == RSubConnection::EAttachToDefault) || (query.iSCPRType == RSubConnection::ECreateNew))
+        {
+        provider = CDummySubConnectionProvider::NewVanillaL(*this);
+        ESOCK_DEBUG_REGISTER_GENERAL_NODE(iUid, provider);
+        }
+    else
+        {
+        User::Leave(KErrNotSupported);
+        }
+    return provider;
+    }
 
 //-=========================================================
 //
 // CDummyNetworkFlowFactory methods
 //
 //-=========================================================	
-namespace ESock
-{
 CDummyNetworkFlowFactory* CDummyNetworkFlowFactory::NewL(TAny* aConstructionParameters)
 	{
 	CDummyNetworkFlowFactory* fact = new (ELeave) CDummyNetworkFlowFactory(
@@ -357,5 +411,4 @@
 
 	return protocolDescription;
 	}
-}
 
--- a/datacommsserver/esockserver/test/providers/dummy/src/dummypr_subconnprov.cpp	Mon May 03 13:39:24 2010 +0300
+++ b/datacommsserver/esockserver/test/providers/dummy/src/dummypr_subconnprov.cpp	Fri May 14 14:12:43 2010 +0100
@@ -27,6 +27,7 @@
 
 #include "dummypr_subconnprov.h"
 #include "dummypr_metaconnprov.h"
+#include "activityTest.h"
 
 #include <elements/sd_mintercept.h>
 
@@ -133,7 +134,7 @@
 NODEACTIVITY_END()
 }
 
-// Activity Map
+// Activity Map For test-code ridden scpr
 namespace DummySCPRStates
 {
 DEFINE_ACTIVITY_MAP(stateMap)
@@ -144,9 +145,26 @@
 ACTIVITY_MAP_END_BASE(SCprActivities, coreSCprActivities)
 }
 
+// Activity Map For vanilla cpr
+namespace VanillaDummySCPRStates
+{
+DECLARE_DEFINE_ACTIVITY_MAP(stateMap)
+        ACTIVITY_MAP_ENTRY(CancelTestBindToActivity, CancelBindTo)   
+ACTIVITY_MAP_END_BASE(SCprActivities, coreSCprActivities)
+}
+
 CDummySubConnectionProvider* CDummySubConnectionProvider::NewL(ESock::CSubConnectionProviderFactoryBase& aFactory)
     {
-    CDummySubConnectionProvider* self = new (ELeave) CDummySubConnectionProvider(aFactory);
+    CDummySubConnectionProvider* self = new (ELeave) CDummySubConnectionProvider(aFactory, DummySCPRStates::stateMap::Self());
+    CleanupStack::PushL(self);
+    self->ConstructL(KDummySCPRPreallocatedActivityBufferSize);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+CDummySubConnectionProvider* CDummySubConnectionProvider::NewVanillaL(ESock::CSubConnectionProviderFactoryBase& aFactory)
+    {
+    CDummySubConnectionProvider* self = new (ELeave) CDummySubConnectionProvider(aFactory, VanillaDummySCPRStates::stateMap::Self());
     CleanupStack::PushL(self);
     self->ConstructL(KDummySCPRPreallocatedActivityBufferSize);
     CleanupStack::Pop(self);
@@ -154,8 +172,8 @@
     }
 
 
-CDummySubConnectionProvider::CDummySubConnectionProvider(CSubConnectionProviderFactoryBase& aFactory)
-:CCoreSubConnectionProvider(aFactory,DummySCPRStates::stateMap::Self())
+CDummySubConnectionProvider::CDummySubConnectionProvider(CSubConnectionProviderFactoryBase& aFactory, const MeshMachine::TNodeActivityMap& aActivityMap)
+:CCoreSubConnectionProvider(aFactory, aActivityMap)
 	{
 	LOG_NODE_CREATE(KDummySCPRTag, CDummySubConnectionProvider);
 	}