Revision: 201018
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Mon, 03 May 2010 13:39:24 +0300
changeset 25 e53adc4c49de
parent 22 592244873960
child 27 cd9717388750
child 30 df67dc5d759e
Revision: 201018 Kit: 201018
commsfwsupport/commselements/commsfw/src/cftransport.cpp
commsfwsupport/commselements/commsfw/src/cfutil.cpp
commsfwsupport/commselements/factories/bwins/factoriesu.def
commsfwsupport/commselements/factories/eabi/factoriesu.def
commsfwsupport/commselements/serverden/src/sd_workersession.cpp
commsfwtools/preparedefaultcommsdatabase/defaultcommdb/group/createcommdbs.pl
commsfwtools/preparedefaultcommsdatabase/installdefaultcommdb/group/installdefaultcommdb.pl
commsfwutils/commsbufs/group/testmbuf.iby
datacommsserver/esockserver/bwins/esocksvrU.DEF
datacommsserver/esockserver/eabi/esocksvrU.DEF
datacommsserver/esockserver/eintsock/ss_eintsock_msgs.inl
datacommsserver/esockserver/inc/SS_conn.H
datacommsserver/esockserver/inc/ss_DataMonitoringProvider.h
datacommsserver/esockserver/inc/ss_connstates.h
datacommsserver/esockserver/inc/ss_nodemessages.h
datacommsserver/esockserver/inc/ss_nodemessages_legacy_internal.h
datacommsserver/esockserver/ssock/ss_DataMonitoringProvider.cpp
datacommsserver/esockserver/ssock/ss_conn.cpp
datacommsserver/esockserver/ssock/ss_connstates.cpp
datacommsserver/esockserver/ssock/ss_nodemessages.cpp
datacommsserver/esockserver/ssock/ss_nodemessages_legacy.cpp
datacommsserver/esockserver/ssock/ss_roles.cpp
datacommsserver/esockserver/ssock/ss_sapshim.cpp
datacommsserver/esockserver/ssock/ss_secpol.cpp
datacommsserver/esockserver/ssock/ss_tiermanager.cpp
datacommsserver/esockserver/ssock/ss_tiermanagerutils.cpp
datacommsserver/esockserver/test/TE_EsockTestSteps/inc/Connections.TestSteps.h
datacommsserver/esockserver/test/TE_EsockTestSteps/inc/EsockTestBase.h
datacommsserver/esockserver/test/TE_EsockTestSteps/src/Connections.TestSteps.cpp
datacommsserver/esockserver/test/TE_EsockTestSteps/src/EsockTestBase.cpp
datacommsserver/esockserver/test/TE_EsockTestSteps/src/Te_esockteststepsSuiteServer.cpp
datacommsserver/esockserver/test/TE_RConnection/configs/Mobility/Mobility_760645.ini
datacommsserver/esockserver/test/TE_RConnection/scripts/Mobility/Mobility_760645.script
datacommsserver/esockserver/test/TE_RConnectionSuite/config/te_rconnectioncmmtests_NonConnection.script
datacommsserver/esockserver/test/TE_RConnectionSuite/inc/TE_RConnectionCMM.h
datacommsserver/esockserver/test/TE_RConnectionSuite/inc/TE_RConnectionStep.h
datacommsserver/esockserver/test/TE_RConnectionSuite/src/TE_RConnectionCMM.cpp
datacommsserver/esockserver/test/TE_RConnectionSuite/src/TE_RConnectionDummyNifTestSteps.cpp
datacommsserver/esockserver/test/TE_RConnectionSuite/src/TE_RConnectionStep.cpp
datacommsserver/esockserver/test/TE_RConnectionSuite/src/TE_RConnectionSuite.cpp
datacommsserver/esockserver/test/util/src/te_esockutilsteps.cpp
datacommsserver/esockserver/test/util/src/ts_esockutilsteps.cpp
--- a/commsfwsupport/commselements/commsfw/src/cftransport.cpp	Fri Apr 16 16:15:03 2010 +0300
+++ b/commsfwsupport/commselements/commsfw/src/cftransport.cpp	Mon May 03 13:39:24 2010 +0300
@@ -1108,7 +1108,7 @@
 	TRuntimeCtxIdOp op(nodeId);
 	op.Set(iPointerSalt, iThreadRegister.SelfWorkerId());
 //TODO - it would be better to print the whole address (aCookie.Size() bytes starting from &aCookie == aCookie.Printable();)
-	__CFLOG_VAR(( KLogCommsFw, KLogFwTransport, _L8("RegisterItf(%08x) => %08x:%08x"), nodeId.Ptr(), *reinterpret_cast<TUint*>(&aCookie), *(reinterpret_cast<TUint*>(&aCookie) + 1)));
+	__CFLOG_VAR(( KLogCommsFw, KLogFwTransport, _L8("RegisterItf(%08x) => %08x %08x"), nodeId.Ptr(), *reinterpret_cast<TUint*>(&aCookie), *(reinterpret_cast<TUint*>(&aCookie) + 1)));
 
 #ifdef SYMBIAN_TRACE_ENABLE
 	__ASSERT_ALWAYS(!iIntfRegister.Find(TIntPtr(nodeId.Ptr())), Panic(ECFTransBadRegistration));
@@ -1135,7 +1135,7 @@
 	{
 	//This transport implementation currently only registers TNodeId
 //TODO - it would be better to print the whole address (aCookie.Size() bytes starting from &aCookie == aCookie.Printable();)
-	__CFLOG_VAR(( KLogCommsFw, KLogFwTransport, _L8("DeregisterItf(%08x => %08x:%08x"), address_cast<TNodeId>(aCookie).Ptr(), *reinterpret_cast<const TUint*>(&aCookie), *(reinterpret_cast<const TUint*>(&aCookie) + 1)));
+	__CFLOG_VAR(( KLogCommsFw, KLogFwTransport, _L8("DeregisterItf(%08x) => %08x %08x"), address_cast<TNodeId>(aCookie).Ptr(), *reinterpret_cast<const TUint*>(&aCookie), *(reinterpret_cast<const TUint*>(&aCookie) + 1)));
 	--iRegisteredCount;
 	__ASSERT_ALWAYS(iRegisteredCount >= 0, Panic(ECFExcessInterfaceDeregistration));
 	aCookie.SetNull();
--- a/commsfwsupport/commselements/commsfw/src/cfutil.cpp	Fri Apr 16 16:15:03 2010 +0300
+++ b/commsfwsupport/commselements/commsfw/src/cfutil.cpp	Mon May 03 13:39:24 2010 +0300
@@ -438,6 +438,7 @@
 		{
 		do 
 			{
+			CleanupStack::PushL(dir);
 			const TInt cnt = dir->Count();
 			for(TInt i = 0; i < cnt; ++i)
 				{
@@ -445,7 +446,7 @@
 				fullEntry.Set(entry.iName, &ff.File(), NULL);      
 				AddL(TOwnEntry(fullEntry, entry));
 				}
-			delete dir;
+			CleanupStack::PopAndDestroy(dir);
 			}
 		while(ff.FindWild(dir) == KErrNone);
 		}	
@@ -469,46 +470,46 @@
 	TParse fullEntry;
 	CDir* dir;
 	RArray<TEntry> files;
+	CleanupClosePushL(files);
 	TBool found;
 	if(ff.FindWildByDir(aFileMask, aDir, dir) == KErrNone)
 		{
 		do 
 			{
+			CleanupStack::PushL(dir);
 			const TInt cnt = dir->Count();
 			for(TInt i = 0; i < cnt; ++i)
 				{
 				const TEntry& entry = (*dir)[i];
-		               if(files.Count()!=0)
-				      {
+				if(files.Count()!=0)
+					{
 					found = EFalse;
 					for( TInt Index=0;Index<files.Count();Index++)
-			    	           {
+						{
 						if(files[Index].iName.CompareF(entry.iName)==0)
-						     {
+							{
 							found = ETrue;
-					             }
-				             }
-	                            if(!found)
-	    	                         {
-				    	   files.Append(entry);
-					   fullEntry.Set(entry.iName, &ff.File(), NULL);      
-					   AddL(TOwnEntry(fullEntry, entry));
-				    	     }
-				       }
-		        	else
-			          {
-			           files.Append(entry);
+							}
+						}
+					if(!found)
+						{
+						files.Append(entry);
+						fullEntry.Set(entry.iName, &ff.File(), NULL);      
+						AddL(TOwnEntry(fullEntry, entry));
+						}
+					}
+				else
+					{
+					files.Append(entry);
 				    fullEntry.Set(entry.iName, &ff.File(), NULL);      
 				    AddL(TOwnEntry(fullEntry, entry));
-				    }		
-							
-		         }
-		     delete dir;
-			
-	           }
-	           while(ff.FindWild(dir) == KErrNone);
-        	}	
-	files.Close();	
+				    }
+				}
+				CleanupStack::PopAndDestroy(dir);
+			}
+		while(ff.FindWild(dir) == KErrNone);
+		}	
+	CleanupStack::PopAndDestroy(&files);
 	fs.Pop();
 	}
 
--- a/commsfwsupport/commselements/factories/bwins/factoriesu.def	Fri Apr 16 16:15:03 2010 +0300
+++ b/commsfwsupport/commselements/factories/bwins/factoriesu.def	Mon May 03 13:39:24 2010 +0300
@@ -29,4 +29,3 @@
 	?SignalDeletion@CFactoryBase@Factories@@AAEXAAVAFactoryObject@2@@Z @ 28 NONAME ; void Factories::CFactoryBase::SignalDeletion(class Factories::AFactoryObject &)
 	?Uid@CFactoryBase@Factories@@QBE?AVTUid@@XZ @ 29 NONAME ; class TUid Factories::CFactoryBase::Uid(void) const
 
-
--- a/commsfwsupport/commselements/factories/eabi/factoriesu.def	Fri Apr 16 16:15:03 2010 +0300
+++ b/commsfwsupport/commselements/factories/eabi/factoriesu.def	Mon May 03 13:39:24 2010 +0300
@@ -48,4 +48,3 @@
 	_ZTVN9Factories17CFactoryContainerE @ 47 NONAME
 	_ZTVN9Factories21CFactoryContainerNodeE @ 48 NONAME
 
-
--- a/commsfwsupport/commselements/serverden/src/sd_workersession.cpp	Fri Apr 16 16:15:03 2010 +0300
+++ b/commsfwsupport/commselements/serverden/src/sd_workersession.cpp	Mon May 03 13:39:24 2010 +0300
@@ -464,26 +464,29 @@
 	iProcess.Close();
 
 	const CCommonServer* s = static_cast<const CCommonServer*>(Server());
-	__ASSERT_DEBUG(s->iNumSessions>0, User::Panic(KDenFaultPanic, ECommonNegativeSessionCount));
-	s->iNumSessions--;
-	COMMONLOG((WorkerId(), KECommonSessDetailTag, _L8("CWorkerSession(%08x):\t~CWorkerSession() iNumSessions=%d (remaining)"), this, s->iNumSessions));
-
-	CCommonWorkerThread& selfWorker = WorkerThread();
-	if (selfWorker.ShuttingDown())
-		{
-		COMMONLOG((WorkerId(), KECommonSessDetailTag, _L8("Shutdown requested: %d sessions"), s->iNumSessions));
-		if (s->iNumSessions <= 0)
-			{
-			if(selfWorker.IsMainThread())
-				{
-				selfWorker.PitBoss().SessionShutdownComplete();
-				}
-			else
-				{
-				selfWorker.MaybeTriggerThreadShutdownCallback();
-				}
-			}
-		}
+	if (s)     // guard against leave during construction (e.g. a leave from CWorkerSession::ConstructL()).
+	    {
+        __ASSERT_DEBUG(s->iNumSessions>0, User::Panic(KDenFaultPanic, ECommonNegativeSessionCount));
+        s->iNumSessions--;
+        COMMONLOG((WorkerId(), KECommonSessDetailTag, _L8("CWorkerSession(%08x):\t~CWorkerSession() iNumSessions=%d (remaining)"), this, s->iNumSessions));
+    
+        CCommonWorkerThread& selfWorker = WorkerThread();
+        if (selfWorker.ShuttingDown())
+            {
+            COMMONLOG((WorkerId(), KECommonSessDetailTag, _L8("Shutdown requested: %d sessions"), s->iNumSessions));
+            if (s->iNumSessions <= 0)
+                {
+                if(selfWorker.IsMainThread())
+                    {
+                    selfWorker.PitBoss().SessionShutdownComplete();
+                    }
+                else
+                    {
+                    selfWorker.MaybeTriggerThreadShutdownCallback();
+                    }
+                }
+            }
+	    }
 	}
 
 EXPORT_C void CWorkerSession::ProcessSubSessions(TWorkerId aPeerId, TSubSessionProcessor aSubSessionProcessor, TAny* aArg)
--- a/commsfwtools/preparedefaultcommsdatabase/defaultcommdb/group/createcommdbs.pl	Fri Apr 16 16:15:03 2010 +0300
+++ b/commsfwtools/preparedefaultcommsdatabase/defaultcommdb/group/createcommdbs.pl	Mon May 03 13:39:24 2010 +0300
@@ -212,13 +212,13 @@
 $zDrive = $release . $cedPlatfrom . '/' . $cedVariant . '/z';
 $zDriveCre = $zDrive . $cccccc00Root . $cccccc00NameCre;
 $CdbEmpty = $zDrive . $cccccc00Root . $cccccc00Nametxt;
+$romCdb = $epocRoot . 'epoc32/' . 'data/z' . $cccccc00Root . $cccccc00NameCre; 
 
 if ($::command eq 'build') 
 {
 	$ced = $release . $cedPlatfrom . '/' . $cedVariant . '/ced.exe';
 	$emulatorstore = $epocRoot . 'epoc32/' . $cedPlatfrom . $cdbIn;
 	$winsCdb = $epocRoot . 'epoc32/' . $cedPlatfrom . '/c' . $cccccc00Root . "persists/" . $cccccc00NameCre;
-	$romCdb = $epocRoot . 'epoc32/' . 'data/z' . $cccccc00Root . $cccccc00NameCre; 
 	
 	if ($platType =~ 'emulator')
 	{
@@ -317,7 +317,10 @@
 		else 
 		{
 			print("$data->{$platType}->{sourceCfg} older than $data->{$platType}->{destinationCdb}\n");
-			print("Construction aborted.\n");
+			print("Construction aborted. Copy-younger of resource CRE only\n");
+			#copy to z drive
+			print("CopyIfYounger $winsCdb to $zDriveCre\n");
+			CopyIfYounger($winsCdb, $zDriveCre);
 		}
 	}
 	else 
@@ -347,6 +350,14 @@
 {
 	print("$data->{$platType}->{destinationCdb}\n");
 	print("$CdbEmpty\n");
+	if($::platform =~ /wins/i)
+	{
+		print("$zDriveCre \n");
+	}
+	else
+	{
+		print("$romCdb\n");
+	}
 }
 
 sub RunCed 
--- a/commsfwtools/preparedefaultcommsdatabase/installdefaultcommdb/group/installdefaultcommdb.pl	Fri Apr 16 16:15:03 2010 +0300
+++ b/commsfwtools/preparedefaultcommsdatabase/installdefaultcommdb/group/installdefaultcommdb.pl	Mon May 03 13:39:24 2010 +0300
@@ -94,19 +94,22 @@
 
 $CdbDest = $data->{$platType}->{destinationCdb};
 
+##
+## NOTE: all copying and releasing is now done from defaultcommdb - this installdefaultcommdb should be entirely deleted, system model updated, etc
+##
 
-if ($::command eq 'build') 
-{
-	PreBuild();
-}
-elsif ($::command eq 'clean')
-{
-	Clean();
-}
-elsif ($::command eq 'releasables') 
-{
-	Releasables();
-}
+#if ($::command eq 'build') 
+#{
+#	PreBuild();
+#}
+#elsif ($::command eq 'clean')
+#{
+#	Clean();
+#}
+#elsif ($::command eq 'releasables') 
+#{
+#	Releasables();
+#}
 
 #
 # Subs.
--- a/commsfwutils/commsbufs/group/testmbuf.iby	Fri Apr 16 16:15:03 2010 +0300
+++ b/commsfwutils/commsbufs/group/testmbuf.iby	Mon May 03 13:39:24 2010 +0300
@@ -23,6 +23,7 @@
 
 file=ABI_DIR\DEBUG_DIR\TS_CTMBUFMGR.DLL						\System\libs\TS_CTMBUFMGR.DLL
 data=EPOCROOT##EPOC32\release\wins\udeb\z\TestData\scripts\mbuftest.script		\testdata\scripts\mbuftest.script
+data=EPOCROOT##EPOC32\release\wins\udeb\z\TestData\scripts\mbuftest.script		\testdata\scripts\mbuftest_zc.script
 data=EPOCROOT##EPOC32\release\wins\udeb\z\TestData\configs\MBufTest05-CopyIn.ini		\testdata\configs\MBufTest05-CopyIn.ini
 data=EPOCROOT##EPOC32\release\wins\udeb\z\TestData\configs\MBufTest05-CopyOut.ini	\testdata\configs\MBufTest05-CopyOut.ini
 data=EPOCROOT##EPOC32\release\wins\udeb\z\TestData\configs\MBufTest06-1st.ini		\testdata\configs\MBufTest06-1st.ini
--- a/datacommsserver/esockserver/bwins/esocksvrU.DEF	Fri Apr 16 16:15:03 2010 +0300
+++ b/datacommsserver/esockserver/bwins/esocksvrU.DEF	Mon May 03 13:39:24 2010 +0300
@@ -1047,4 +1047,10 @@
 	?Self@PRClientLeft@PRClientLeftActivity@@SAABUTNodeActivity@MeshMachine@@XZ @ 1046 NONAME ; struct MeshMachine::TNodeActivity const & PRClientLeftActivity::PRClientLeft::Self(void)
 	?FirstTriple@PRClientLeft@PRClientLeftActivity@@SAABUTStateTriple@NetStateMachine@@XZ @ 1047 NONAME ; struct NetStateMachine::TStateTriple const & PRClientLeftActivity::PRClientLeft::FirstTriple(void)
 	?Accept@TAwaitingStop@CoreNetStates@@UAEHXZ @ 1048 NONAME ; int CoreNetStates::TAwaitingStop::Accept(void)
-	
+	?GetVDataTable@TTierTypeIdFactoryQuery@ESock@@UBEPBUSVDataTableEntry@Meta@@XZ @ 1049 NONAME ; struct Meta::SVDataTableEntry const * ESock::TTierTypeIdFactoryQuery::GetVDataTable(void) const
+	?GetAttribPtr@TTierTypeIdFactoryQuery@ESock@@UBEPAEH@Z @ 1050 NONAME ; unsigned char * ESock::TTierTypeIdFactoryQuery::GetAttribPtr(int) const
+	??0TTierTypeIdFactoryQuery@ESock@@QAE@VTUid@@@Z @ 1051 NONAME ; ESock::TTierTypeIdFactoryQuery::TTierTypeIdFactoryQuery(class TUid)
+	??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)
+
--- a/datacommsserver/esockserver/eabi/esocksvrU.DEF	Fri Apr 16 16:15:03 2010 +0300
+++ b/datacommsserver/esockserver/eabi/esocksvrU.DEF	Mon May 03 13:39:24 2010 +0300
@@ -1948,3 +1948,15 @@
 	_ZN20PRClientLeftActivity12PRClientLeft11FirstTripleEv @ 1947 NONAME
 	_ZN20PRClientLeftActivity12PRClientLeft4SelfEv @ 1948 NONAME
 	_ZN13CoreNetStates13TAwaitingStop6AcceptEv @ 1949 NONAME
+	_ZN5ESock23TTierTypeIdFactoryQuery19GetVDataTableStaticEv @ 1950 NONAME
+	_ZN5ESock23TTierTypeIdFactoryQuery5MatchERN9Factories18TFactoryObjectInfoE @ 1951 NONAME
+	_ZN5ESock23TTierTypeIdFactoryQueryC1E4TUid @ 1952 NONAME
+	_ZN5ESock23TTierTypeIdFactoryQueryC1Ev @ 1953 NONAME
+	_ZN5ESock23TTierTypeIdFactoryQueryC2E4TUid @ 1954 NONAME
+	_ZN5ESock23TTierTypeIdFactoryQueryC2Ev @ 1955 NONAME
+	_ZNK5ESock23TTierTypeIdFactoryQuery12GetAttribPtrEi @ 1956 NONAME
+	_ZNK5ESock23TTierTypeIdFactoryQuery13GetVDataTableEv @ 1957 NONAME
+	_ZTIN5ESock23TTierTypeIdFactoryQueryE @ 1958 NONAME
+	_ZTVN5ESock23TTierTypeIdFactoryQueryE @ 1959 NONAME
+	_ZThn4_N5ESock23TTierTypeIdFactoryQuery5MatchERN9Factories18TFactoryObjectInfoE @ 1960 NONAME
+
--- a/datacommsserver/esockserver/eintsock/ss_eintsock_msgs.inl	Fri Apr 16 16:15:03 2010 +0300
+++ b/datacommsserver/esockserver/eintsock/ss_eintsock_msgs.inl	Mon May 03 13:39:24 2010 +0300
@@ -195,6 +195,10 @@
 	{
 	TParams* params = reinterpret_cast<TParams*>(ParamBlock());
 	params->iSender = aSender;
+    
+	// caution - TRuntimeCtxId assignment operator overloaded - it assumes a properly constructed destination, which it isn't here
+	// so we in-place construct it
+	new (&params->iImplCookie)Messages::TNodeId();
 	params->iImplCookie = aImplCookie;
 	}
 
--- a/datacommsserver/esockserver/inc/SS_conn.H	Fri Apr 16 16:15:03 2010 +0300
+++ b/datacommsserver/esockserver/inc/SS_conn.H	Mon May 03 13:39:24 2010 +0300
@@ -35,6 +35,8 @@
 	class TClearProgressQueue;
 	class TRequestCSRCreation;
 	class TProcessStateChange;
+    class TEnqueueStateChange;	
+	class TAwaitingStateChange;
 	class TProcessIncomingConnection;
 	class TProcessProgressRequest;
 	class TParseECNAttach;
@@ -42,10 +44,8 @@
 	class TProcessBinderResponseForCpr;
 	class TCompleteLegacyAttach;
 	class TProcessEnumResponse;
-
 	class TGenerateConnectionUpProgress;
 	class TGenerateConnectionDownProgress;
-
 	class TNoTagOrCancelAllInterfaceWorker;
 	class TCancelAllInterfaceNotificationWorker;
 }
@@ -139,6 +139,8 @@
 	friend class ConnStates::TClearProgressQueue;
 	friend class ConnStates::TRequestCSRCreation;
 	friend class ConnStates::TProcessStateChange;
+	friend class ConnStates::TAwaitingStateChange;
+	friend class ConnStates::TEnqueueStateChange;  
 	friend class ConnStates::TProcessIncomingConnection;
 	friend class ConnStates::TProcessProgressRequest;
 	friend class ConnStates::TParseECNAttach;
--- a/datacommsserver/esockserver/inc/ss_DataMonitoringProvider.h	Fri Apr 16 16:15:03 2010 +0300
+++ b/datacommsserver/esockserver/inc/ss_DataMonitoringProvider.h	Mon May 03 13:39:24 2010 +0300
@@ -172,7 +172,7 @@
 public:
 	TNotificationRequest(CDataMonitoringResponder* aResponder, TSubSessionUniqueId aClientId) 
 		: iThreshold(0), iResponder(aResponder), iClientId(aClientId), iCancelled(EFalse), iWrapped(EFalse)
-		{		
+		{
 		}
 	
 	TUint32 Threshold() const
@@ -205,7 +205,7 @@
 		
 	void SetCancelled()
 		{
-		iCancelled = ETrue;
+	    iCancelled = ETrue;
 		}
 	
 	TBool Wrapped() const
@@ -220,6 +220,7 @@
 
 	static TInt CompareThresholds(const TNotificationRequest& aFirst, const TNotificationRequest& aSecond);
 	static TBool CompareClientIds(const TNotificationRequest& aFirst, const TNotificationRequest& aSecond);
+	static TBool CompareClientIdsAndCancelledFlag(const TNotificationRequest& aFirst, const TNotificationRequest& aSecond);
 	
 private:
 	TUint32 iThreshold;	
--- a/datacommsserver/esockserver/inc/ss_connstates.h	Fri Apr 16 16:15:03 2010 +0300
+++ b/datacommsserver/esockserver/inc/ss_connstates.h	Mon May 03 13:39:24 2010 +0300
@@ -235,10 +235,18 @@
 
 //
 //Progress & Progress Request
+DECLARE_SMELEMENT_HEADER( TAwaitingStateChange, MeshMachine::TState<TContext>, NetStateMachine::MState, TContext )
+    virtual TBool Accept();
+DECLARE_SMELEMENT_FOOTER( TAwaitingStateChange )
+
 DECLARE_SMELEMENT_HEADER( TProcessStateChange, MeshMachine::TStateTransition<TContext>, NetStateMachine::MStateTransition, TContext ) //From the framework
 	virtual void DoL();
 DECLARE_SMELEMENT_FOOTER( TProcessStateChange )
 
+DECLARE_SMELEMENT_HEADER( TEnqueueStateChange, MeshMachine::TStateTransition<TContext>, NetStateMachine::MStateTransition, TContext ) //From the framework
+    virtual void DoL();
+DECLARE_SMELEMENT_FOOTER( TEnqueueStateChange )
+
 DECLARE_SMELEMENT_HEADER( TProcessProgressRequest, SubSessStates::TECABStateTransitionBase<TContext>, NetStateMachine::MStateTransition, TContext ) //From the client
 	virtual void DoL();
 DECLARE_SMELEMENT_FOOTER( TProcessProgressRequest )
@@ -258,7 +266,9 @@
 	virtual void DoL();
 DECLARE_SMELEMENT_FOOTER( TGenerateConnectionDownProgress )
 	
-
+DECLARE_SMELEMENT_HEADER( TGenerateConnectionUninitialisedProgress,  MeshMachine::TStateTransition<TContext>, NetStateMachine::MStateTransition, TContext ) //From the framework
+    virtual void DoL();
+DECLARE_SMELEMENT_FOOTER( TGenerateConnectionUninitialisedProgress )
 
 
 
--- a/datacommsserver/esockserver/inc/ss_nodemessages.h	Fri Apr 16 16:15:03 2010 +0300
+++ b/datacommsserver/esockserver/inc/ss_nodemessages.h	Mon May 03 13:39:24 2010 +0300
@@ -115,6 +115,23 @@
 	EXPORT_DATA_VTABLE_AND_FN
 	};
 
+class TTierTypeIdFactoryQuery : public TFactoryQueryBase
+    {
+public:
+    IMPORT_C TTierTypeIdFactoryQuery();
+
+    IMPORT_C explicit TTierTypeIdFactoryQuery(const TUid aTierTypeId);
+
+protected:
+    IMPORT_C virtual Factories::MFactoryQuery::TMatchResult Match(Factories::TFactoryObjectInfo& aFactoryObjectInfo);
+
+public:
+    TUid iTierTypeId;
+
+    DECLARE_MVIP_CTR(TTierTypeIdFactoryQuery)
+    EXPORT_DATA_VTABLE_AND_FN
+    };
+
 class TDefaultConnectionFactoryQuery : public TFactoryQueryBase
 /** Class implementing MFactoryQuery to find a connection provider.
 
--- a/datacommsserver/esockserver/inc/ss_nodemessages_legacy_internal.h	Fri Apr 16 16:15:03 2010 +0300
+++ b/datacommsserver/esockserver/inc/ss_nodemessages_legacy_internal.h	Mon May 03 13:39:24 2010 +0300
@@ -319,6 +319,10 @@
 	virtual void DoDataSentNotification(TUint32 aSentBytes);
 	virtual void DoDataReceivedNotification(TUint32 aReceivedBytes);
 
+protected:
+   virtual void DoComplete(TInt aError);
+
+
 private:
 	IMPORT_C static CLegacyDataMonitoringResponder* NewL(ESock::RLegacyResponseMsg& aResponseMsg);
 	CLegacyDataMonitoringResponder(ESock::RLegacyResponseMsg& aResponseMsg);
--- a/datacommsserver/esockserver/ssock/ss_DataMonitoringProvider.cpp	Fri Apr 16 16:15:03 2010 +0300
+++ b/datacommsserver/esockserver/ssock/ss_DataMonitoringProvider.cpp	Mon May 03 13:39:24 2010 +0300
@@ -114,8 +114,8 @@
 
 	// Ensure this client has not registered before or if it has, any outstanding requests are
 	// marked as cancelled.
-	TInt requestIdx = iReceivedNotificationRequests.Find(notificationRequest, TIdentityRelation<TNotificationRequest>(TNotificationRequest::CompareClientIds));
-	if(requestIdx != KErrNotFound && !iReceivedNotificationRequests[requestIdx]->Cancelled())
+	TInt requestIdx = iReceivedNotificationRequests.Find(notificationRequest, TIdentityRelation<TNotificationRequest>(TNotificationRequest::CompareClientIdsAndCancelledFlag));
+	if(requestIdx != KErrNotFound)
 		{
 		delete notificationRequest;
 		CDataMonitoringResponder::Error(aResponder, KErrInUse);
@@ -162,14 +162,17 @@
 	TNotificationRequest exemplarRequest(NULL, aClientId);
 	
 	// Locate the request matching the specified client ID
-	TInt requestIdx = iReceivedNotificationRequests.Find(&exemplarRequest, TIdentityRelation<TNotificationRequest>(TNotificationRequest::CompareClientIds));	
-	if(requestIdx != KErrNotFound && !iReceivedNotificationRequests[requestIdx]->Cancelled())
+	TInt requestIdx = iReceivedNotificationRequests.Find(&exemplarRequest, TIdentityRelation<TNotificationRequest>(TNotificationRequest::CompareClientIdsAndCancelledFlag));	
+	if(requestIdx != KErrNotFound)
 		{
 		TNotificationRequest* notificationRequest = iReceivedNotificationRequests[requestIdx];
 		
 		// Cancel it and complete the client
 		notificationRequest->SetCancelled();
 		CDataMonitoringResponder::CancelRequest(notificationRequest->Responder());
+		
+		iReceivedNotificationRequests.Remove(requestIdx); 
+        delete notificationRequest;
 		}
 	}
 
@@ -187,8 +190,8 @@
 	
 	// Ensure this client has not registered before or if it has, any outstanding requests are
 	// marked as cancelled.
-	TInt requestIdx = iSentNotificationRequests.Find(notificationRequest, TIdentityRelation<TNotificationRequest>(TNotificationRequest::CompareClientIds));
-	if(requestIdx != KErrNotFound && !iSentNotificationRequests[requestIdx]->Cancelled())
+	TInt requestIdx = iSentNotificationRequests.Find(notificationRequest, TIdentityRelation<TNotificationRequest>(TNotificationRequest::CompareClientIdsAndCancelledFlag));
+	if(requestIdx != KErrNotFound)
 		{
 		delete notificationRequest;
 		CDataMonitoringResponder::Error(aResponder, KErrInUse);
@@ -235,14 +238,17 @@
 	TNotificationRequest exemplarRequest(NULL, aClientId);
 	
 	// Locate the request matching the specified client id
-	TInt requestIdx = iSentNotificationRequests.Find(&exemplarRequest, TIdentityRelation<TNotificationRequest>(TNotificationRequest::CompareClientIds));
-	if(requestIdx != KErrNotFound && !iSentNotificationRequests[requestIdx]->Cancelled())
+	TInt requestIdx = iSentNotificationRequests.Find(&exemplarRequest, TIdentityRelation<TNotificationRequest>(TNotificationRequest::CompareClientIdsAndCancelledFlag));
+	if(requestIdx != KErrNotFound)
 		{
 		TNotificationRequest* notificationRequest = iSentNotificationRequests[requestIdx];
 		
 		// Cancel it and complete the client
 		notificationRequest->SetCancelled();
 		CDataMonitoringResponder::CancelRequest(notificationRequest->Responder());
+
+		iSentNotificationRequests.Remove(requestIdx);
+		delete notificationRequest;
 		}
 	}
 
@@ -527,6 +533,21 @@
 		}
 	}
 
+/**
+    Compares two TNotificationRequest objects using their client ids and the cancelled flag as the criteria.
+*/
+TBool TNotificationRequest::CompareClientIdsAndCancelledFlag(const TNotificationRequest& aFirst, const TNotificationRequest& aSecond)
+    {
+    if(aFirst.ClientId() == aSecond.ClientId())
+        {
+        return aFirst.Cancelled() == aSecond.Cancelled();
+        }
+    else
+        {
+        return EFalse;
+        }
+    }
+
 EXPORT_START_ATTRIBUTE_TABLE_AND_FN(TDataMonitoringProvisioningInfoBase, TDataMonitoringProvisioningInfoBase::iUid, TDataMonitoringProvisioningInfoBase::iId)
 	REGISTER_ATTRIBUTE(TDataMonitoringProvisioningInfoBase, iDataVolumesPtr, TMeta<TDataMonitoringProvisioningInfoBase*>)
 	REGISTER_ATTRIBUTE(TDataMonitoringProvisioningInfoBase, iThresholdsPtr, TMeta<TDataMonitoringProvisioningInfoBase*>)
--- a/datacommsserver/esockserver/ssock/ss_conn.cpp	Fri Apr 16 16:15:03 2010 +0300
+++ b/datacommsserver/esockserver/ssock/ss_conn.cpp	Mon May 03 13:39:24 2010 +0300
@@ -151,8 +151,8 @@
 	THROUGH_NODEACTIVITY_ENTRY(KErrorTag, ConnActivities::CStartAttachActivity::TSetIdleIfStopOutstanding, MeshMachine::TErrorTag)
 
 	NODEACTIVITY_ENTRY(KErrorTag, CoreNetStates::TSendClientLeavingRequestToServiceProviders, MeshMachine::TAwaitingLeaveComplete, MeshMachine::TNoTag)
-	NODEACTIVITY_ENTRY(KNoTag, CoreNetStates::TSetIdleIfNoServiceProviders, MeshMachine::TAwaitingLeaveComplete, ConnectionCleanupActivities::TNoTagOrNoTagBackwards)
-	LAST_NODEACTIVITY_ENTRY(KNoTag, MeshMachine::TDoNothing)
+	NODEACTIVITY_ENTRY(KNoTag, MeshMachine::TDoNothing, MeshMachine::TAwaitingLeaveComplete, ConnectionCleanupActivities::TNoTagOrNoTagBackwards)
+	LAST_NODEACTIVITY_ENTRY(KNoTag, ConnStates::TGenerateConnectionUninitialisedProgress)
 NODEACTIVITY_END()
 }
 
@@ -204,10 +204,10 @@
     THROUGH_NODEACTIVITY_ENTRY(KNoTag, ConnStates::TGenerateConnectionDownProgress, MeshMachine::TNoTag)
 
 	NODEACTIVITY_ENTRY(KNoTag, CoreNetStates::TSendClientLeavingRequestToServiceProviders, MeshMachine::TAwaitingLeaveComplete, MeshMachine::TNoTag)
-	NODEACTIVITY_ENTRY(KNoTag, CoreNetStates::TSetIdleIfNoServiceProviders, MeshMachine::TAwaitingLeaveComplete, ConnectionCleanupActivities::TNoTagOrNoTagBackwards)
+	NODEACTIVITY_ENTRY(KNoTag, MeshMachine::TDoNothing, MeshMachine::TAwaitingLeaveComplete, ConnectionCleanupActivities::TNoTagOrNoTagBackwards)
 	
 	LAST_NODEACTIVITY_ENTRY(CoreNetStates::KNoBearer, MeshMachine::TDoNothing)
-	LAST_NODEACTIVITY_ENTRY(KNoTag, MeshMachine::TDoNothing)
+	LAST_NODEACTIVITY_ENTRY(KNoTag, ConnStates::TGenerateConnectionUninitialisedProgress)
 NODEACTIVITY_END()
 }
 
@@ -269,22 +269,35 @@
     THROUGH_NODEACTIVITY_ENTRY(KNoTag, ConnStates::TCancelAllLegacyRMessage2Activities, ConnStates::TNoTagBlockedByLegacyRMessage2Activities)
 	NODEACTIVITY_ENTRY(KNoTag, ConnStates::TProcessClose, TECABState<MeshMachine::TAwaitingLeaveComplete>, MeshMachine::TNoTag)
 	//TDestroyAwaitingLeaveCompleteLoop loops back to its own triple if more SPs
-	NODEACTIVITY_ENTRY(KNoTag, TECABTransition<CoreNetStates::TSetIdleIfNoServiceProviders>, TECABState<MeshMachine::TAwaitingLeaveComplete>, CoreActivities::CDestroyActivity::TNoTagOrNoTagBackwards)
-	LAST_NODEACTIVITY_ENTRY(KNoTag, MeshMachine::TDoNothing) //Never gets here
+	NODEACTIVITY_ENTRY(KNoTag, MeshMachine::TDoNothing, TECABState<MeshMachine::TAwaitingLeaveComplete>, CoreActivities::CDestroyActivity::TNoTagOrNoTagBackwards)
+	LAST_NODEACTIVITY_ENTRY(KNoTag, MeshMachine::TDoNothing)
 NODEACTIVITY_END()
 }
 
+//--------------------------------------------------
+//Progress/TStateChange activities.
+//ConnectionStateChangeNotificationActivity acts on the subscription and completes the client with progresses
+//ConnectionStateChangeActivity acts on TStateChange coming from the stack.
 namespace ConnectionStateChangeNotificationActivity
 {
 DECLARE_DEFINE_CUSTOM_NODEACTIVITY(ECFActivityConnectionStateChangeRequest, ConnectionStateChangeNotification, TCFInternalEsock::TSubSess, CESockClientActivityBase::NewL)
 	FIRST_NODEACTIVITY_ENTRY(SubSessStates::TAwaitingIPC<ECNProgressNotification>, MeshMachine::TNoTag)
 	THROUGH_NODEACTIVITY_ENTRY(KNoTag, SubSessStates::TAcquireMessageOwnership, MeshMachine::TNoTag)
-	//TAwaitingStateChangeLoop also cancels the activity when requested
-	NODEACTIVITY_ENTRY(KNoTag, ConnStates::TProcessProgressRequest, TECABState<MeshMachine::TAwaitingMessageState<TCFMessage::TStateChange> >, 		MeshMachine::TNoTagBackward)
+	NODEACTIVITY_ENTRY(KNoTag, ConnStates::TProcessProgressRequest, TECABState<ConnStates::TAwaitingStateChange >, MeshMachine::TNoTag)
+	
+	NODEACTIVITY_ENTRY(KNoTag, ConnStates::TProcessStateChange, TECABState<ConnStates::TAwaitingStateChange >, MeshMachine::TNoTagBackward)
 	LAST_NODEACTIVITY_ENTRY(KNoTag, MeshMachine::TDoNothing) //Never gets here
 NODEACTIVITY_END()
 }
 
+namespace ConnectionStateChangeActivity
+{
+DECLARE_DEFINE_NODEACTIVITY(ECFActivityStateChange, ConnectionStateChange, TCFMessage::TStateChange)
+    NODEACTIVITY_ENTRY(KNoTag, ConnStates::TEnqueueStateChange, ConnStates::TAwaitingStateChange, MeshMachine::TNoTag)
+NODEACTIVITY_END()
+}
+
+
 namespace ConnectionWaitForIncomingActivity
 { //Synchronised, waits for Start to complete
 DECLARE_DEFINE_CUSTOM_NODEACTIVITY(ECFActivityConnectionWaitForIncoming, ConnectionWaitForIncoming, TCFInternalEsock::TSubSess, CStartAttachActivity::NewWaitForIncomingConnectionActivityL)
@@ -297,15 +310,6 @@
 NODEACTIVITY_END()
 }
 
-//
-//Activities serving framework requests
-namespace ConnectionStateChangeActivity
-{
-DECLARE_DEFINE_NODEACTIVITY(ECFActivityStateChange, ConnectionStateChange, TCFMessage::TStateChange)
-	NODEACTIVITY_ENTRY(KNoTag, ConnStates::TProcessStateChange, MeshMachine::TAwaitingMessageState<TCFMessage::TStateChange>, MeshMachine::TNoTag)
-NODEACTIVITY_END()
-}
-
 
 namespace ConnectionGoingDownActivity
 {
@@ -316,8 +320,8 @@
     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)
-	NODEACTIVITY_ENTRY(KNoTag, CoreNetStates::TSetIdleIfNoServiceProviders, MeshMachine::TAwaitingLeaveComplete, ConnectionCleanupActivities::TNoTagOrNoTagBackwards)
-    LAST_NODEACTIVITY_ENTRY(KNoTag, MeshMachine::TDoNothing)
+	NODEACTIVITY_ENTRY(KNoTag, MeshMachine::TDoNothing, MeshMachine::TAwaitingLeaveComplete, ConnectionCleanupActivities::TNoTagOrNoTagBackwards)
+    LAST_NODEACTIVITY_ENTRY(KNoTag, ConnStates::TGenerateConnectionUninitialisedProgress)
 NODEACTIVITY_END()
 }
 
--- a/datacommsserver/esockserver/ssock/ss_connstates.cpp	Fri Apr 16 16:15:03 2010 +0300
+++ b/datacommsserver/esockserver/ssock/ss_connstates.cpp	Mon May 03 13:39:24 2010 +0300
@@ -625,6 +625,159 @@
     return EFalse;
 	}
 
+
+
+//----------------------------------------------------
+//Handling Progress/TStateChange
+DEFINE_SMELEMENT(ConnStates::TAwaitingStateChange, NetStateMachine::MState, ConnStates::TContext)
+TBool ConnStates::TAwaitingStateChange::Accept()
+    {
+    TCFMessage::TStateChange* progressMsg = message_cast<TCFMessage::TStateChange>(&iContext.iMessage);
+    if (progressMsg)
+        {
+        TStateChange& progress = progressMsg->iStateChange;
+        
+		// Check whether KDataTransferUnblocked is received and if yes, then traslate it to KConnectionUp (== KLinkLayerOpen)
+		// the log only sees the translated version, this goes into the queue, so it alright I suppose.
+		if (progress.iStage == KDataTransferUnblocked )
+			{
+			progress.iStage = KConnectionUp;    // KLinkLayerOpen
+			}
+		if (progress.iError == KErrForceDisconnected)
+			{
+			progress.iError = KErrDisconnected;
+			}
+        
+		// CConnection trusts that locally generated progresses are to be trusted,
+		// but some of the legacy progresses coming from the stack need some filtering.
+		// Here's the filtering.
+		if (iContext.iSender != iContext.Node().Id())
+            {
+            if (progress.iStage == KConnectionUninitialised)
+                {
+                //KConnectionUninitialised has been deprecated in the stack and it will be ignored
+                //when reported by it. It is still valid towards the application. Here it is being reported by the stack.
+                //The original KConnectionUninitialised denoted CAgentReference destruction and as such speculated too
+                //much about the sturcture of the stack (notably: there isn't necesserily an agent anymore.
+                //As defined KConnectionUninitialised would need to be reported after TCFControlClient::TGoneDown or TCFServiceProvider::TStopped,
+                //except the stack decomposes after TCFControlClient::TGoneDown or TCFServiceProvider::TStopped and the progress path along with
+                //it. It is therefore impossible for the stack to generate KConnectionUninitialised after
+                //TCFControlClient::TGoneDown or TCFServiceProvider::TStopped. CConnection takes over and will generate KConnectionUninitialised
+                //when detatching from the service providers (see ConnStates::TGenerateConnectionUninitialisedProgress)
+                LOG( ESockLog::Printf(KESockConnectionTag, _L("CConnection %08x:\tProgressNotification(TInt aStage %d, TInt aError %d) - deprecated progress, ignoring"),
+                        &(iContext.Node()), progress.iStage, progress.iError) );
+                progressMsg->ClearMessageId();
+                return EFalse;
+                }   
+            }
+        LOG( ESockLog::Printf(KESockConnectionTag, _L("CConnection %08x:\tProgressNotification(TInt aStage %d, TInt aError %d)"),
+            &(iContext.Node()), progress.iStage, progress.iError) );
+        
+        CConnection& cc = iContext.Node();
+        if (cc.iLastProgress == progress)
+            {
+            progressMsg->ClearMessageId();            
+            return EFalse; //ignore this duplicate
+            }
+        cc.iLastProgress = progress;
+
+        if (progress.iError != KErrNone)
+            {
+            cc.iLastProgressError = progress; //Save last progress in error for use by LastProgressErrorL()
+            }
+        return ETrue;
+        }
+    return EFalse;
+    }
+
+//Progress & Progress Request
+DEFINE_SMELEMENT(ConnStates::TEnqueueStateChange, NetStateMachine::MStateTransition, ConnStates::TContext)
+void ConnStates::TEnqueueStateChange::DoL()
+    {
+    TStateChange& progress = message_cast<TCFMessage::TStateChange>(iContext.iMessage).iStateChange;
+    //Diagnostic assertion.
+    
+    //If ECFActivityConnectionStateChangeRequest is running, it has not been
+    //presented with the TStateChange message (channel activity id != 0?) which is a serious mistake.
+    __ASSERT_DEBUG(iContext.Node().CountActivities(ECFActivityConnectionStateChangeRequest)==0, User::Panic(KSpecAssert_ESockSSockscnsts, 9));
+
+    CConnection& cc = iContext.Node();
+#ifdef ESOCK_LOGGING_ACTIVE
+    // Check to see if the progress queue is full causing older progress to be discarded.
+    // This has the potential to cause problems if a critical progress item is lost.
+    // Normally the queue is large enough such that this doesn't happen but this log entry
+    // serves as a warning if it ever does.
+    if( cc.iProgressQueue.IsFull() )
+        {
+        LOG( ESockLog::Printf(KESockConnectionTag, _L("CConnection %08x:\tThe maximum progress queue size of %d has been exceeded - discarding old progress to make space for new item"), this, KMaxProgressQueueLength); )
+        }
+#endif
+    
+    //Add the progress to queue
+    cc.iProgressQueue.Enque(progress);
+    }
+
+
+DEFINE_SMELEMENT(ConnStates::TProcessProgressRequest, NetStateMachine::MStateTransition, ConnStates::TContext)
+void ConnStates::TProcessProgressRequest::DoL()
+    {
+    __ASSERT_DEBUG(iContext.iNodeActivity, ConnPanic(KPanicNoActivity));
+    CESockClientActivityBase& ac = static_cast<CESockClientActivityBase&>(*iContext.iNodeActivity);
+    TUint selectedProgressStage = ac.Int1();
+    TStateChange progress;
+    TBool found = EFalse;
+
+    __ASSERT_DEBUG((subsessmessage_cast<ECNProgressNotification>(&iContext.iMessage)), ConnPanic(KPanicIncorrectMessage));
+    
+    //Process the queue looking for the progress of interest
+    found = iContext.Node().iProgressQueue.Deque(progress);
+    if (found && selectedProgressStage != KConnProgressDefault)
+        {
+        // For a selected progress request, dequeue entries until we find one which
+        // matches the criteria.  If we dequeue all entries, fall through without
+        // completing the message.  It it not considered useful to retain un-matching
+        // entries on the queue if a selected progress request is pending.
+        while (found)
+            {
+            if (progress.iStage == selectedProgressStage || progress.iError != KErrNone)
+                {
+                break;
+                }
+            found = iContext.Node().iProgressQueue.Deque(progress);
+            }
+        }
+
+    if (found)
+        {
+        //We have found a progress of interest, finish
+        TPckg<TStateChange> progressPkg(progress);
+        ac.WriteL(0,progressPkg);
+        ac.SetIdle(); //We are done
+        }
+    }
+
+DEFINE_SMELEMENT(ConnStates::TProcessStateChange, NetStateMachine::MStateTransition, ConnStates::TContext)
+void ConnStates::TProcessStateChange::DoL()
+    {
+    __ASSERT_DEBUG(iContext.iNodeActivity, ConnPanic(KPanicNoActivity));
+    CESockClientActivityBase& ac = static_cast<CESockClientActivityBase&>(*iContext.iNodeActivity);
+    TUint selectedProgressStage = ac.Int1();
+
+    //Are we here as a result of receiving TStateChange (rather than ECNProgressNotification)?
+    TCFMessage::TStateChange& progress = message_cast<TCFMessage::TStateChange>(iContext.iMessage);
+
+    if (selectedProgressStage == KConnProgressDefault || 
+        selectedProgressStage == progress.iStateChange.iStage || 
+        KErrNone != progress.iStateChange.iError)
+        {
+        //We have found a progress of interest, finish
+        TPckg<TStateChange> progressPkg(progress.iStateChange);
+        ac.WriteL(0,progressPkg);
+        ac.SetIdle(); //We are done
+        }
+    }
+
+
 DEFINE_SMELEMENT(ConnStates::TGenerateConnectionUpProgress, NetStateMachine::MStateTransition, ConnStates::TContext)
 void ConnStates::TGenerateConnectionUpProgress::DoL()
 	{
@@ -657,119 +810,19 @@
 		}
 	}
 
-//
-//Progress & Progress Request
-DEFINE_SMELEMENT(ConnStates::TProcessStateChange, NetStateMachine::MStateTransition, ConnStates::TContext)
-void ConnStates::TProcessStateChange::DoL()
-	{
-	TStateChange& progress = message_cast<TCFMessage::TStateChange>(iContext.iMessage).iStateChange;
-
-	//Check whether KDataTransferUnblocked is received and if yes, then traslate it to KConnectionUp (== KLinkLayerOpen)
-	// the log only sees the translated version, this goes into the queue, so it alright I suppose.
-	if (progress.iStage == KDataTransferUnblocked )
-		{
-		progress.iStage = KConnectionUp;	// KLinkLayerOpen
-		}
-	if (progress.iError == KErrForceDisconnected)
-		{
-		progress.iError = KErrDisconnected;
-		}
-
-	LOG( ESockLog::Printf(KESockConnectionTag, _L("CConnection %08x:\tProgressNotification(TInt aStage %d, TInt aError %d)"),
-		&(iContext.Node()), progress.iStage, progress.iError) );
-
-	//Diagnostic assertion.
-	//If ECFActivityConnectionStateChangeRequest is running, it has not been
-	//presented with the TStateChange message (channel activity id != 0?) which is a serious mistake.
-	__ASSERT_DEBUG(iContext.Node().CountActivities(ECFActivityConnectionStateChangeRequest)==0, User::Panic(KSpecAssert_ESockSSockscnsts, 9));
-
-	CConnection& cc = iContext.Node();
-	if (cc.iLastProgress == progress)
-		{
-		return; //ignore this duplicate
-		}
-	cc.iLastProgress = progress;
-
-	if (progress.iError != KErrNone)
-		{
-        cc.iLastProgressError = progress; //Save last progress in error for use by LastProgressErrorL()
-    	}
-
-	#ifdef ESOCK_LOGGING_ACTIVE
-		// Check to see if the progress queue is full causing older progress to be discarded.
-		// This has the potential to cause problems if a critical progress item is lost.
-		// Normally the queue is large enough such that this doesn't happen but this log entry
-		// serves as a warning if it ever does.
-		if( cc.iProgressQueue.IsFull() )
-			{
-			LOG( ESockLog::Printf(KESockConnectionTag, _L("CConnection %08x:\tThe maximum progress queue size of %d has been exceeded - discarding old progress to make space for new item"), this, KMaxProgressQueueLength); )
-			}
-	#endif
-
-	//Add the progress to queue
-	cc.iProgressQueue.Enque(progress);
-	}
-
-DEFINE_SMELEMENT(ConnStates::TProcessProgressRequest, NetStateMachine::MStateTransition, ConnStates::TContext)
-void ConnStates::TProcessProgressRequest::DoL()
-	{
-	__ASSERT_DEBUG(iContext.iNodeActivity, ConnPanic(KPanicNoActivity));
-	CESockClientActivityBase& ac = static_cast<CESockClientActivityBase&>(*iContext.iNodeActivity);
-	TUint selectedProgressStage = ac.Int1();
-
-	TStateChange progress;
-	TBool found = EFalse;
-
-	//Are we here as a result of receiving TStateChange (rather than ECNProgressNotification)?
-	TCFMessage::TStateChange* msg = message_cast<TCFMessage::TStateChange>(&iContext.iMessage);
-	if (msg)
-		{ //Yes, we have been triggered by a TStateChange message
-		//Check if this is the progress we are waiting for, otherwise dump the progress
-		//Check whether KDataTransferUnblocked is received and if yes, then traslate it to KConnectionUp (== KLinkLayerOpen)
-		if (msg->iStateChange.iStage == KDataTransferUnblocked )
-			{
-			msg->iStateChange.iStage = KConnectionUp;	// KLinkLayerOpen
-			}
-		if (selectedProgressStage == KConnProgressDefault
-			|| selectedProgressStage == msg->iStateChange.iStage
-				|| KErrNone != msg->iStateChange.iError)
-			{
-			progress = msg->iStateChange;
-			found = ETrue;
-			}
-		}
-	else
-		{ //No, we must have been triggered by a ECNProgressNotification message
-		__ASSERT_DEBUG((subsessmessage_cast<ECNProgressNotification>(&iContext.iMessage)), ConnPanic(KPanicIncorrectMessage));
-
-		//Process the queue looking for the progress of interest
-		found = iContext.Node().iProgressQueue.Deque(progress);
-		if (found && selectedProgressStage != KConnProgressDefault)
-			{
-			// For a selected progress request, dequeue entries until we find one which
-			// matches the criteria.  If we dequeue all entries, fall through without
-			// completing the message.  It it not considered useful to retain un-matching
-			// entries on the queue if a selected progress request is pending.
-			while (found)
-				{
-				if (progress.iStage == selectedProgressStage || progress.iError != KErrNone)
-					{
-					break;
-					}
-				found = iContext.Node().iProgressQueue.Deque(progress);
-				}
-			}
-		}
-
-	if (found)
-		{
-		//We have found a progress of interest, finish
-		TPckg<TStateChange> progressPkg(progress);
-		ac.WriteL(0,progressPkg);
-		ac.SetIdle(); //We are done
-		}
-	}
-
+DEFINE_SMELEMENT(ConnStates::TGenerateConnectionUninitialisedProgress, NetStateMachine::MStateTransition, ConnStates::TContext)
+void ConnStates::TGenerateConnectionUninitialisedProgress::DoL()
+    {
+    if (iContext.Node().CountActivities(ECFActivityDestroy) == 0)
+        {//TGenerateConnectionUninitialisedProgress is called when the stack goes away 
+         //below the CConnection's feet and it sometimes goes away because CConnection is
+         //being ECNClosed and therefore sitting on an electric chair. It is risky, but
+         //above all uselsess to send the progress when when app clearly doesn't want
+         //to see it.
+        TCFMessage::TStateChange msg(TStateChange(KConnectionUninitialised, KErrNone));
+        RNodeInterface::OpenPostMessageClose(iContext.Node().Id(), iContext.Node().Id(), msg);
+        }
+    }
 
 //
 //Legacy enumeration
@@ -1597,8 +1650,6 @@
     {
 	if ( iContext.iMessage.IsMessage<TEPeer::TLeaveComplete>() )
 		{
-//		__ASSERT_DEBUG(iContext.Node().GetClientIter(RNodeInterface::ECtrl|RNodeInterface::EData)[0] == NULL,
-//		User::Panic(KCorePRPanic, KPanicClientsStillPresent));
 		if (iContext.Node().GetFirstClient<TDefaultClientMatchPolicy>(TCFClientType(TCFClientType::EServProvider)) == NULL)
 			{ // This was the last service provider
 			return NetStateMachine::EForward | MeshMachine::KNoTag;
--- a/datacommsserver/esockserver/ssock/ss_nodemessages.cpp	Fri Apr 16 16:15:03 2010 +0300
+++ b/datacommsserver/esockserver/ssock/ss_nodemessages.cpp	Mon May 03 13:39:24 2010 +0300
@@ -134,6 +134,7 @@
 	EDefaultSCPRFactoryQuery		=1010,
 	EDefaultFlowFactoryQuery		=1011,
 	EDefaultProtocolIntfFactoryQuery =1012,	
+	ETierTypeIdFactoryQuery     =1013,
 	};
 
 //no need to serialise return value
@@ -263,6 +264,10 @@
 	REGISTER_ATTRIBUTE(TMetaConnectionFactoryQuery, iTierImplUid, TMeta<TUint>)  
 END_ATTRIBUTE_TABLE()
 
+EXPORT_START_ATTRIBUTE_TABLE_AND_FN(TTierTypeIdFactoryQuery, KESockInternalMessagesImplementationUid, ETierTypeIdFactoryQuery)  
+    REGISTER_ATTRIBUTE(TTierTypeIdFactoryQuery, iTierTypeId, TMeta<TUint>)  
+END_ATTRIBUTE_TABLE()
+
 EXPORT_START_ATTRIBUTE_TABLE_AND_FN(TDefaultConnectionFactoryQuery, KESockInternalMessagesImplementationUid, EDefaultConnectionFactoryQuery)	
 	REGISTER_ATTRIBUTE(TDefaultConnectionFactoryQuery, iMCprId, TMeta<TNodeId>)	
 END_ATTRIBUTE_TABLE()
@@ -330,6 +335,7 @@
 DEFINE_MVIP_CTR(TDefaultSCPRFactoryQuery)
 DEFINE_MVIP_CTR(TDefaultFlowFactoryQuery)
 DEFINE_MVIP_CTR(TDefaultProtocolIntfFactoryQuery)
+DEFINE_MVIP_CTR(TTierTypeIdFactoryQuery)
 
 
 const TImplementationProxy SignatureImplementationTable[] =
@@ -373,6 +379,7 @@
 	MVIP_CTR_ENTRY(EDefaultSCPRFactoryQuery, TDefaultSCPRFactoryQuery), //1008	
 	MVIP_CTR_ENTRY(EDefaultFlowFactoryQuery, TDefaultFlowFactoryQuery),
 	MVIP_CTR_ENTRY(EDefaultProtocolIntfFactoryQuery, TDefaultProtocolIntfFactoryQuery),	
+	MVIP_CTR_ENTRY(ETierTypeIdFactoryQuery, TTierTypeIdFactoryQuery), //1013
 	};
 
 
@@ -641,6 +648,23 @@
 	return prov->ProviderInfo() == iProviderInfo? MFactoryQuery::EMatch : MFactoryQuery::EContinue;		
 	}
 
+EXPORT_C TTierTypeIdFactoryQuery::TTierTypeIdFactoryQuery()
+    {
+        
+    }
+
+EXPORT_C TTierTypeIdFactoryQuery::TTierTypeIdFactoryQuery(const TUid aTierTypeId)
+: iTierTypeId(aTierTypeId)
+    {
+    
+    }
+    
+EXPORT_C MFactoryQuery::TMatchResult TTierTypeIdFactoryQuery::Match(Factories::TFactoryObjectInfo& aFactoryObjectInfo)
+    {
+    CTierManagerBase* prov = static_cast<CTierManagerBase*>(aFactoryObjectInfo.iInfo.iFactoryObject);
+    return prov->TierId() == iTierTypeId ? MFactoryQuery::EMatch : MFactoryQuery::EContinue;     
+    }
+
 EXPORT_C TDefaultConnectionFactoryQuery::TDefaultConnectionFactoryQuery(const Messages::TNodeId& aMCprId)
 : iMCprId(aMCprId)
 	{
--- a/datacommsserver/esockserver/ssock/ss_nodemessages_legacy.cpp	Fri Apr 16 16:15:03 2010 +0300
+++ b/datacommsserver/esockserver/ssock/ss_nodemessages_legacy.cpp	Mon May 03 13:39:24 2010 +0300
@@ -103,18 +103,8 @@
 	ASSERT(aContext.Activity() != NULL);
 	RNodeInterface* rcpt = NULL;
 
-	/* At the connection level we want to go down active serviceprovider, as there are multiple
-	   and the first one is usually an scpr */
-	if (aContext.Activity()->ActivitySigId() == ECFActivityConnectionLegacyRMessage2Handler)
-		{
-		rcpt = aContext.Node().GetFirstClient<TDefaultClientMatchPolicy>(TClientType(TCFClientType::EServProvider, TCFClientType::EActive),
+	rcpt = aContext.Node().GetFirstClient<TDefaultClientMatchPolicy>(TClientType(TCFClientType::EServProvider, TCFClientType::EActive),
 			Messages::TClientType(0, Messages::TClientType::ELeaving));
-		}
-	else
-		{
-		rcpt = aContext.Node().GetFirstClient<TDefaultClientMatchPolicy>(TClientType(TCFClientType::EServProvider),
-			Messages::TClientType(0, Messages::TClientType::ELeaving));
-		}
 
     if(rcpt)
     	{
@@ -508,6 +498,11 @@
     }
 
 
+void CLegacyDataMonitoringResponder::DoComplete(TInt aError)
+    {
+    iLegacyResponseMsg.Complete(aError);
+    }
+
 void CLegacyDataMonitoringResponder::DoCancelRequest()
 	{
 	iLegacyResponseMsg.Complete(KErrCancel);
@@ -731,9 +726,9 @@
 	RLegacyResponseMsg responseMsg(aContext, iMessage, iMessage.Int0());
 	CDataMonitoringResponder* responder = CLegacyDataMonitoringResponder::NewL(responseMsg);
 
-    	ADataMonitoringProtocolReq& dataMonItf = *static_cast<ADataMonitoringProtocolReq*>(interface);
-    	switch(iDirection)
-    		{
+    ADataMonitoringProtocolReq& dataMonItf = *static_cast<ADataMonitoringProtocolReq*>(interface);
+    switch(iDirection)
+        {
 		case ESent:
 			dataMonItf.RequestDataSentNotification(responder, delta, volume, iClientId);
 			break;
@@ -741,19 +736,20 @@
 		case EReceived:
 			dataMonItf.RequestDataReceivedNotification(responder, delta, volume, iClientId);
 			break;
+		
 		default:
 			delete responder;
-    		}
+        }
 	// coverity [leaked_storage] - responder is owned by dataMonItf.RequestDataSentNotification, dataMonItf.RequestDataReceivedNotification
 	// therefore we don't need to push them onto the cleanup stack.
-    	}
+	}
 
 void TLegacyDataMonitoringNotificationRequest::Cancel(MeshMachine::TNodeContextBase& aContext)
 	{
 	TAny* interface = FetchInterfaceL(aContext.Node(), EDataMonitoringApiExt);
 	ASSERT(interface);
 	
-	if (interface)
+    if (interface)
     	{
     	ADataMonitoringProtocolReq& dataMonItf = *static_cast<ADataMonitoringProtocolReq*>(interface);
 		
--- a/datacommsserver/esockserver/ssock/ss_roles.cpp	Fri Apr 16 16:15:03 2010 +0300
+++ b/datacommsserver/esockserver/ssock/ss_roles.cpp	Mon May 03 13:39:24 2010 +0300
@@ -1797,7 +1797,6 @@
 	else
 		{
     	err = KErrNoMemory;
-    	CleanupStack::Pop(startupInfo);
    		}
 
    	return err;
--- a/datacommsserver/esockserver/ssock/ss_sapshim.cpp	Fri Apr 16 16:15:03 2010 +0300
+++ b/datacommsserver/esockserver/ssock/ss_sapshim.cpp	Mon May 03 13:39:24 2010 +0300
@@ -1365,18 +1365,11 @@
 		}
 	else if (iHostResolverNotify)
 	    {//workaroud to indicate to CHostResolver we've got connection info
-	    if (aBindTo.iNodeId.Ptr())
-	        {
-    	    iHostResolverNotify->StartSending();
-	        }
-	    else
+	    if (!aBindTo.iNodeId.Ptr())
 	        {
             iHostResolverNotify->Error(KErrDisconnected);
 	        }
 	    }
-
-
-
 	}
 
 
@@ -1415,6 +1408,13 @@
 		iStartRequest.Close();
 		SetStarted();
 		ClearStopped();
+
+        // A held-over resolution request will now work (if it ever will)
+        if (iHostResolverNotify)
+	        {
+    	    iHostResolverNotify->StartSending();
+	        }
+
 		return;
 		}
 
--- a/datacommsserver/esockserver/ssock/ss_secpol.cpp	Fri Apr 16 16:15:03 2010 +0300
+++ b/datacommsserver/esockserver/ssock/ss_secpol.cpp	Mon May 03 13:39:24 2010 +0300
@@ -166,7 +166,11 @@
 
 */
 	{
-	__ASSERT_ALWAYS(aMsg.Function() == ECNControl, Fault(ENotImplementedYet));
+	// ECNControl is all we are expecting
+	if(aMsg.Function() != ECNControl)
+		{
+		return EFail;
+		}
 
    TInt optionLevel = aMsg.Int0();
 
--- a/datacommsserver/esockserver/ssock/ss_tiermanager.cpp	Fri Apr 16 16:15:03 2010 +0300
+++ b/datacommsserver/esockserver/ssock/ss_tiermanager.cpp	Mon May 03 13:39:24 2010 +0300
@@ -113,13 +113,21 @@
 	if (aMessage.IsMessage<TCFInternalEsock::TCreateCSR>())
 		{
 		TCFInternalEsock::TCreateCSR& msg = message_cast<TCFInternalEsock::TCreateCSR>(aMessage);
-		// Maps Tier to ImplId For ECOM since ImplId is used in Factory
-		CommsDat::CMDBSession* dbs = CommsDat::CMDBSession::NewLC(KCDVersion1_2);
-		msg.iUid= TierManagerUtils::MapTierIdtoTierImplIdL(msg.iUid, *dbs);
-		CleanupStack::PopAndDestroy(dbs);
-		CCommsFactoryBase* factory = static_cast<CCommsFactoryBase*>(FindOrCreateFactoryL(msg.iUid));
-		TAlwaysFindFactoryQuery query;
-		CSelectionRequest* sr = CSelectionRequest::NewL(address_cast<TNodeId>(aSender), factory->FindOrCreateObjectL(query)->Id());
+		TTierTypeIdFactoryQuery tierTypeQuery(msg.iUid);
+		ACommsFactoryNodeId* obj = Find(tierTypeQuery);   // match the address family to tierTypeId in factory container
+		if (!obj)
+	        {
+            // object not found, use the commsdat to find the Tier Manager
+            CommsDat::CMDBSession* dbs = CommsDat::CMDBSession::NewLC(KCDVersion1_2);
+            // Maps Tier to ImplId For ECOM since ImplId is used in Factory
+            msg.iUid= TierManagerUtils::MapTierIdtoTierImplIdL(msg.iUid, *dbs);
+            CleanupStack::PopAndDestroy(dbs);
+            CCommsFactoryBase* factory = static_cast<CCommsFactoryBase*>(FindOrCreateFactoryL(msg.iUid));
+            TAlwaysFindFactoryQuery query;  // since there is only one Tier Manager per Tier Manager factory, return the first one
+            obj = factory->FindOrCreateObjectL(query);
+	        }
+		
+		CSelectionRequest* sr = CSelectionRequest::NewL(address_cast<TNodeId>(aSender), obj->Id());
 		RClientInterface::OpenPostMessageClose(Id(), aSender, TCFInternalEsock::TCSRCreated(sr->Id()).CRef());
 		aMessage.ClearMessageId();
 		}
--- a/datacommsserver/esockserver/ssock/ss_tiermanagerutils.cpp	Fri Apr 16 16:15:03 2010 +0300
+++ b/datacommsserver/esockserver/ssock/ss_tiermanagerutils.cpp	Mon May 03 13:39:24 2010 +0300
@@ -738,27 +738,25 @@
 EXPORT_C TUid TierManagerUtils::MapTierIdtoTierImplIdL(TUid aTierUid,CommsDat::CMDBSession& aDbs )
 /** mapping TM Id to TM ImplId in Commsdat */
 	{
-	TUid ImplUid;
-	// if it does not exist, it returns tier id
-	ImplUid = aTierUid;
+    TUid ImplUid;
+    // if it does not exist, it returns tier id
+    ImplUid = aTierUid;
+
+    CCDTierRecord* tierRec = static_cast<CCDTierRecord*>(CCDRecordBase::RecordFactoryL(KCDTIdTierRecord));
+    CleanupStack::PushL(tierRec);
+    tierRec->iRecordTag = aTierUid.iUid;
+
+    TBool found = tierRec->FindL(aDbs);
 
-	CMDBRecordSet<CCDTierRecord>* recSet = new (ELeave) CMDBRecordSet<CCDTierRecord>(KCDTIdTierRecord);
-	CleanupStack::PushL(recSet);
-	recSet->LoadL(aDbs);
-	const TInt recCnt = recSet->iRecords.Count();
-	
-	for(TInt i = 0; i < recCnt; i++)
-		{
-		CCDTierRecord* rec = static_cast<CCDTierRecord*>(recSet->iRecords[i]);
-		if(rec->iRecordTag == aTierUid.iUid)
-			{
-			ImplUid.iUid = rec->iTierImplUid;
-			}
-		}
-	
-	CleanupStack::PopAndDestroy(recSet);	
-	return ImplUid;
-	}
+    if (found)
+        {
+        ImplUid.iUid = tierRec->iTierImplUid;
+        }
+
+    CleanupStack::PopAndDestroy(tierRec);   
+    return ImplUid;
+
+    }
 //
 // CCommsDatIapView
 //
--- a/datacommsserver/esockserver/test/TE_EsockTestSteps/inc/Connections.TestSteps.h	Fri Apr 16 16:15:03 2010 +0300
+++ b/datacommsserver/esockserver/test/TE_EsockTestSteps/inc/Connections.TestSteps.h	Mon May 03 13:39:24 2010 +0300
@@ -25,6 +25,7 @@
 #define CONNECTIONS_TESTSTEPS_H
 
 #include <test/testexecutestepbase.h>
+#include <metadatabase.h>
 #include "Te_EsockStepBase.h"
 
 _LIT(KTe_ConnectionName,"ConnName");
@@ -41,6 +42,9 @@
 _LIT(KTe_CommDbBearerCSD,"KCommDbBearerCSD");
 _LIT(KTe_CommDbBearerWcdma,"KCommDbBearerWcdma");
 _LIT(KTe_CommDbBearerLAN,"KCommDbBearerLAN");
+_LIT(KTe_ParameterType, "ParameterType");
+_LIT(KTe_ParameterExpectedValue,"ParameterExpectedValue");
+
 
 //mobility api
 _LIT(KTe_MobilityAPIName,"MobilityExtName");
@@ -424,6 +428,22 @@
 _LIT(KCheckNegativeProgressNotificationStep,"CheckNegativeProgressNotificationStep");
 
 
+class CGetParameters_IntStep : public CTe_EsockStepBase
+    {
+public:
+    CGetParameters_IntStep(CCEsockTestBase*& aEsockTest);
+    TVerdict doSingleTestStep();
+    TInt ConfigureFromIni();
+private:
+    TPtrC iConnectionName;
+    TPtrC iFieldName;    
+    CommsDat::TMDBElementId iRecordTypeId;
+    TInt  iExpectedValue;
+    };
+
+_LIT(KGetParameters_IntStep,"GetParameters_IntStep");
+
+
 #endif // CONNECTIONS_TESTSTEPS_H
 
 
--- a/datacommsserver/esockserver/test/TE_EsockTestSteps/inc/EsockTestBase.h	Fri Apr 16 16:15:03 2010 +0300
+++ b/datacommsserver/esockserver/test/TE_EsockTestSteps/inc/EsockTestBase.h	Mon May 03 13:39:24 2010 +0300
@@ -517,6 +517,8 @@
     TInt CreateAvailabilityExtension(const TDesC& aAvailabilityExtensionName);
     TInt RegisterForProgressNotificationEvent(const TEventContainerParams& aParams);
     TInt ReceiveProgressNotificationEvent(TNifProgress*& aNifProgress, const TDesC& aEventName, TUint aTimeoutInMiliSec = 0);
+    TInt GetParameters(TPtrC aConnectionName, ESock::CCommsDataObjectBase& aDataObject);
+    TInt GetIntSetting(TPtrC aConnectionName, const TDesC& aSettingName, TUint32& aValue);
 
     //mobility extensions
     RCommsMobilityApiExt* FindMobilityExtension(const TDesC& aMobilityExtensionName);
--- a/datacommsserver/esockserver/test/TE_EsockTestSteps/src/Connections.TestSteps.cpp	Fri Apr 16 16:15:03 2010 +0300
+++ b/datacommsserver/esockserver/test/TE_EsockTestSteps/src/Connections.TestSteps.cpp	Mon May 03 13:39:24 2010 +0300
@@ -22,6 +22,9 @@
 #include "SocketServer.TestSteps.h"
 #include "Sockets.TestSteps.h"
 #include <cdbcols.h>
+#include <commsdattypeinfov1_1.h>
+#include <comms-infras/es_commsdataobject.h>
+#include <comms-infras/connectionqueryset.h>
 
 
 #ifdef _DEBUG
@@ -1205,4 +1208,103 @@
 	}
 
 
+// GetParameters_Int
+//-------------------------------
 
+CGetParameters_IntStep::CGetParameters_IntStep(CCEsockTestBase*& aEsockTest)
+:   CTe_EsockStepBase(aEsockTest)
+    {
+    SetTestStepName(KGetParameters_IntStep);
+    }
+
+TInt CGetParameters_IntStep::ConfigureFromIni()
+    {
+    // Read in appropriate fields
+    if((GetStringFromConfig(iSection, KTe_ConnectionName, iConnectionName) != 1)
+        || (iConnectionName.Length() == 0))
+        {
+        INFO_PRINTF1(_L("Couldn't find appropriate field in config file"));
+        return KErrNotFound;
+        }
+
+    if((GetStringFromConfig(iSection, KTe_ParameterType, iFieldName) != 1)
+        || (iFieldName.Length() == 0))
+        {
+        INFO_PRINTF1(_L("Couldn't find appropriate field in config file"));
+        return KErrNotFound;
+        }
+    _LIT(KIapTableIdDes, "IAP\\Id" );
+    if (iFieldName.Compare(KIapTableIdDes) == 0)
+        {
+        iRecordTypeId = CommsDat::KCDTIdIAPRecord | CommsDat::KCDTIdRecordTag;
+        }
+    /*else
+     * Don't get too angry, but so far, this generic looking test step only does IAP
+     * There are nice arrays in CED that can be used to address any field. If you're
+     * desperate, please pull them in and modify this test step to be able to retrieve
+     * any field 
+     */
+
+    if(!GetIntFromConfig(iSection, KTe_ParameterExpectedValue, iExpectedValue))
+        {
+        INFO_PRINTF1(_L("Couldn't find appropriate field in config file"));
+        return KErrNotFound;
+        }
+    
+    return KErrNone;
+    }
+
+
+TVerdict CGetParameters_IntStep::doSingleTestStep()
+    {
+    TInt ret = KErrNone;
+    ESock::XConnectionQuerySet* querySet = NULL;
+    TRAP(ret, querySet = ESock::XConnectionQuerySet::NewL() );
+   
+    if ( ret == KErrNone )
+        {
+        TRAP(ret, ESock::XUintQuery::NewL(iRecordTypeId, *querySet) );
+        }
+    ESock::CConnectionQuerySet* connectionQuerySet = NULL;
+    if ( ret == KErrNone )
+        {
+        TRAP(ret, connectionQuerySet = ESock::CConnectionQuerySet::NewL(querySet) );
+        }    
+    
+    if( (ret = iEsockTest->GetParameters(iConnectionName, *connectionQuerySet)) != KErrNone)
+        {
+        INFO_PRINTF2(_L("RConnection::GetParameters returned %d"), ret);
+        SetTestStepError(ret);
+        return EFail;
+        }
+
+    ESock::XConnectionQuerySet& outputQuerySet = connectionQuerySet->DataObject();
+    ESock::XUintQuery* iapTableIdQuery = static_cast<ESock::XUintQuery*>(outputQuerySet.FindQuery( iRecordTypeId ));
+    __ASSERT_DEBUG(iapTableIdQuery, User::Panic(KSpecAssert_ESockTestCnctnsT, 2));
+    if (iapTableIdQuery->Error() != KErrNone)
+        {
+        INFO_PRINTF2(_L("RConnection::GetParameters Int query returned (%d)"), iapTableIdQuery->Error());
+        SetTestStepError(KErrCorrupt);
+        return EFail;        
+        }
+    
+    if (iapTableIdQuery->Data() != iExpectedValue)
+        {
+        INFO_PRINTF3(_L("RConnection::GetParameters Int query returned (%d) something else than expected (%d)"), iapTableIdQuery->Data(), iExpectedValue);
+        SetTestStepError(KErrCorrupt);
+        return EFail;        
+        }
+    
+    /*Just out of justified paranoia, we're extracting the same field using RConnection::GetIntSetting*/
+    TUint32 aValue;
+    iEsockTest->GetIntSetting(iConnectionName, iFieldName, aValue);
+    if (aValue != iExpectedValue)
+        {
+        INFO_PRINTF3(_L("RConnection::GetIntSetting returned (%d) something else than expected (%d)"), aValue, iExpectedValue);
+        SetTestStepError(KErrCorrupt);
+        return EFail;        
+        }
+           
+    return EPass;
+    }
+
--- a/datacommsserver/esockserver/test/TE_EsockTestSteps/src/EsockTestBase.cpp	Fri Apr 16 16:15:03 2010 +0300
+++ b/datacommsserver/esockserver/test/TE_EsockTestSteps/src/EsockTestBase.cpp	Mon May 03 13:39:24 2010 +0300
@@ -1232,6 +1232,23 @@
 	return KErrNone;
 	}
 
+TInt CCEsockTestBase::GetParameters(TPtrC aConnectionName, ESock::CCommsDataObjectBase& aDataObject)
+    {
+    RConnection* c = iConns.Find(aConnectionName);
+    if (c==NULL)
+        return KErrNotFound;
+    return c->GetParameters(aDataObject);
+    }
+
+TInt CCEsockTestBase::GetIntSetting(TPtrC aConnectionName, const TDesC& aSettingName, TUint32& aValue)
+    {
+    RConnection* c = iConns.Find(aConnectionName);
+    if (c==NULL)
+        return KErrNotFound;
+    return c->GetIntSetting(aSettingName, aValue);
+    }
+
+
 TInt CCEsockTestBase::StartConnection(TRConnectionParams& aParams)
 	{
     RConnection* c = iConns.Find(aParams.iConnectionName);
@@ -2235,6 +2252,8 @@
     return ec->iEventReceived.Int();
     }
 
+
+
 //
 //cleanup
 
--- a/datacommsserver/esockserver/test/TE_EsockTestSteps/src/Te_esockteststepsSuiteServer.cpp	Fri Apr 16 16:15:03 2010 +0300
+++ b/datacommsserver/esockserver/test/TE_EsockTestSteps/src/Te_esockteststepsSuiteServer.cpp	Mon May 03 13:39:24 2010 +0300
@@ -422,6 +422,7 @@
 	NEW_ESOCK_TESTSTEP(RegisterProgressNotificationStep)
 	NEW_ESOCK_TESTSTEP(CheckProgressNotificationStep)
 	NEW_ESOCK_TESTSTEP(CheckNegativeProgressNotificationStep)
+	NEW_ESOCK_TESTSTEP(GetParameters_IntStep)	
 	return testStep;
 	}
 
--- a/datacommsserver/esockserver/test/TE_RConnection/configs/Mobility/Mobility_760645.ini	Fri Apr 16 16:15:03 2010 +0300
+++ b/datacommsserver/esockserver/test/TE_RConnection/configs/Mobility/Mobility_760645.ini	Mon May 03 13:39:24 2010 +0300
@@ -57,11 +57,13 @@
 [MigrateToPreferredCarrier]
 MobilityExtName=MobExt1
 
-[RejectNewCarrier]
+[AcceptNewCarrier]
 MobilityExtName=MobExt1
 
-[AcceptNewCarrier]
-MobilityExtName=MobExt1
+[CheckNewIAP]
+ConnName=Conn1
+ParameterType=IAP\Id
+ParameterExpectedValue=5
 
 [CloseMobilityExtension]
 MobilityExtName=MobExt1
--- a/datacommsserver/esockserver/test/TE_RConnection/scripts/Mobility/Mobility_760645.script	Fri Apr 16 16:15:03 2010 +0300
+++ b/datacommsserver/esockserver/test/TE_RConnection/scripts/Mobility/Mobility_760645.script	Mon May 03 13:39:24 2010 +0300
@@ -23,6 +23,7 @@
 PRINT Simulate current AP going down,
 PRINT Receive PreferredCarierAvailable but no KLinkLayerClosed,
 PRINT Migration to the new AP,
+PRINT RConnection::GetParameters(IAP) to check the reported IAP is expected
 PRINT New AP goes down, reception of KLinkLayerClosed ,
 PRINT RCommsMobilityApiExt::Close()
 
@@ -84,6 +85,10 @@
 //Check we did not receive the Klinklayerclosed event
 RUN_TEST_STEP 100 te_esockteststepsSuite CheckNegativeProgressNotificationStep z:\testdata\configs\BearerMobility\Mobility_760645.ini CheckNegativeProgressNotificationEvent1 
 
+//Check IAP
+RUN_TEST_STEP 150 te_esockteststepsSuite GetParameters_IntStep z:\testdata\configs\BearerMobility\Mobility_760645.ini CheckNewIAP
+
+
 //Simulate the new access point going down and receive 
 RUN_TEST_STEP 150 te_esockteststepsSuite SetAccessPointAvailabilityStep z:\testdata\configs\BearerMobility\Mobility_760645.ini ChangeAvailabilityDownAp5
 
--- a/datacommsserver/esockserver/test/TE_RConnectionSuite/config/te_rconnectioncmmtests_NonConnection.script	Fri Apr 16 16:15:03 2010 +0300
+++ b/datacommsserver/esockserver/test/TE_RConnectionSuite/config/te_rconnectioncmmtests_NonConnection.script	Mon May 03 13:39:24 2010 +0300
@@ -274,6 +274,64 @@
 test_complete
 END_TESTCASE			COMINF-ESOCK-RConnectionSuite-CMM-0622
 
+
+
+START_TESTCASE			COMINF-ESOCK-RConnectionSuite-CMM-0481
+//! @SYMTestCaseID		COMINF-ESOCK-RConnectionSuite-CMM-0481
+//!@SYMTestCaseDesc     Data Monitoring cancellation test - sent data notification
+// 						NOTE: If this test fails it can bring down esock when the connection stops (because of the original defect in esock)
+run_script z:\TestData\scripts\te_esock_test_unloadesockForced.script
+run_script z:\TestData\scripts\te_esock_test_loadesock.script
+heap_mark
+run_test_step 100, TE_RConnectionSuite Test481 c:\rconnectiontest.ini
+heap_markend
+test_complete
+END_TESTCASE			COMINF-ESOCK-RConnectionSuite-CMM-0481
+
+
+
+START_TESTCASE			COMINF-ESOCK-RConnectionSuite-CMM-0482
+//! @SYMTestCaseID		COMINF-ESOCK-RConnectionSuite-CMM-0482
+//!@SYMTestCaseDesc     Data Monitoring cancellation test - received data notification 
+// 						NOTE: If this test fails it can bring down esock when the connection stops (because of the original defect in esock)
+run_script z:\TestData\scripts\te_esock_test_unloadesockForced.script
+run_script z:\TestData\scripts\te_esock_test_loadesock.script
+heap_mark
+run_test_step 100, TE_RConnectionSuite Test482 c:\rconnectiontest.ini
+heap_markend
+test_complete
+END_TESTCASE			COMINF-ESOCK-RConnectionSuite-CMM-0482
+
+
+
+START_TESTCASE			COMINF-ESOCK-RConnectionSuite-CMM-0483
+//! @SYMTestCaseID		COMINF-ESOCK-RConnectionSuite-CMM-0483
+//!@SYMTestCaseDesc     Data Monitoring cancellation test - sent data notification 
+// 						NOTE: If this test fails it can bring down esock when the connection stops (because of the original defect in esock)
+run_script z:\TestData\scripts\te_esock_test_unloadesockForced.script
+run_script z:\TestData\scripts\te_esock_test_loadesock.script
+heap_mark
+run_test_step 100, TE_RConnectionSuite Test483 c:\rconnectiontest.ini
+heap_markend
+test_complete
+END_TESTCASE			COMINF-ESOCK-RConnectionSuite-CMM-0483
+
+
+
+START_TESTCASE			COMINF-ESOCK-RConnectionSuite-CMM-0484
+//! @SYMTestCaseID		COMINF-ESOCK-RConnectionSuite-CMM-0484
+//!@SYMTestCaseDesc     Data Monitoring cancellation test - received data notification 
+// 						NOTE: If this test fails it can bring down esock when the connection stops (because of the original defect in esock)
+run_script z:\TestData\scripts\te_esock_test_unloadesockForced.script
+run_script z:\TestData\scripts\te_esock_test_loadesock.script
+heap_mark
+run_test_step 100, TE_RConnectionSuite Test484 c:\rconnectiontest.ini
+heap_markend
+test_complete
+END_TESTCASE			COMINF-ESOCK-RConnectionSuite-CMM-0484
+
+
+
 run_script z:\TestData\scripts\te_esock_test_unloadesockForced.script
 
 run_utils MakeReadWrite c:\rconnectiontest.ini
--- a/datacommsserver/esockserver/test/TE_RConnectionSuite/inc/TE_RConnectionCMM.h	Fri Apr 16 16:15:03 2010 +0300
+++ b/datacommsserver/esockserver/test/TE_RConnectionSuite/inc/TE_RConnectionCMM.h	Mon May 03 13:39:24 2010 +0300
@@ -861,6 +861,31 @@
 	virtual enum TVerdict doTestStepL ();
 };
 
+class TE_RConnectionTest481 : public TE_RConnectionStep
+{
+public:
+    virtual enum TVerdict doTestStepL();
+};
+
+class TE_RConnectionTest482 : public TE_RConnectionStep
+{
+public:
+    virtual enum TVerdict doTestStepL();
+};
+
+class TE_RConnectionTest483 : public TE_RConnectionStep
+{
+public:
+    virtual enum TVerdict doTestStepL();
+};
+
+class TE_RConnectionTest484 : public TE_RConnectionStep
+{
+public:
+    virtual enum TVerdict doTestStepL();
+};
+
+
 class TE_RConnectionTest319 : public TE_RConnectionStep
 {
 public:
--- a/datacommsserver/esockserver/test/TE_RConnectionSuite/inc/TE_RConnectionStep.h	Fri Apr 16 16:15:03 2010 +0300
+++ b/datacommsserver/esockserver/test/TE_RConnectionSuite/inc/TE_RConnectionStep.h	Mon May 03 13:39:24 2010 +0300
@@ -238,6 +238,13 @@
 	
 	
 	void WaitForRelevantProgress(RConnection& aConn, TNifProgressBuf& aProgress, TInt aRelevantProgress);
+	
+	/**
+	@param aStatus The TRequestStatus you want to wait on
+	@param aTimeOut The time in microseconds to wait for the request to complete before returning
+	@return ETrue if the request completed, EFalse if the timeout happened first 
+	*/
+	TBool WaitForRequestOrTimeOutL(TRequestStatus& aStatus, TInt aTimeOut);
 
 protected:
 	// this is the config data read from the .ini file in ReadIniFile().
--- a/datacommsserver/esockserver/test/TE_RConnectionSuite/src/TE_RConnectionCMM.cpp	Fri Apr 16 16:15:03 2010 +0300
+++ b/datacommsserver/esockserver/test/TE_RConnectionSuite/src/TE_RConnectionCMM.cpp	Mon May 03 13:39:24 2010 +0300
@@ -26,6 +26,7 @@
 #include <inet6err.h>
 #include <in6_opt.h>
 
+
 /**
  * Subconnection Management API extensions
  * 
@@ -7269,5 +7270,445 @@
 } // TE_RConnectionTest319
 
 
+
+enum TVerdict TE_RConnectionTest481::doTestStepL(void)
+/**
+ * Test 481
+ * Test DataSentNotificationRequest() cancellation
+ * Added for defect ou1cimx1#305124.
+ * Tests that cancellation of the request does indeed cancel the request
+ * Defect summary: was the case that the first cancel cancelled the request but left
+ * a notification structure in existence. The second cancel would see the structure
+ * and think that the cancellation had already been done leaving the request outstanding.
+ * @return enum TVerdict Indicates status of test run. See INFO_PRINTF1.h for possible values
+ */
+{
+    TInt err;
+    TRequestStatus status1;
+
+    RSocketServ ss;
+    err = OpenSocketServer(ss);
+    TESTEL(KErrNone == err, err);
+    CleanupClosePushL(ss);
+
+    //********** connection creation ***********
+    RConnection conn1;
+    err = OpenConnection(conn1, ss);
+    TESTEL(KErrNone == err, err);
+    CleanupClosePushL(conn1);
+
+    // start the dummynif
+    err = StartConnectionWithOverrides(conn1, iDummyNifLongTimeoutIap);
+    TESTEL(KErrNone == err, err);
+    err = conn1.SetOpt(KCOLProvider, KConnDisableTimers, ETrue);
+    TESTEL(KErrNone == err, err);
+
+    RSocket sock1;
+    err = OpenUdpSocketExplicitL(sock1, ss, conn1);
+    TESTEL(KErrNone == err, err);
+    CleanupClosePushL(sock1);
+
+    INFO_PRINTF1(_L("First DataSentNotificationRequest"));
+    // Request DataSentNotificationRequest
+    TUint volume1(0); 
+    TPckg<TUint> volume1Des(volume1);
+    TUint threshold1(KLowThresholdSize);
+    conn1.DataSentNotificationRequest(threshold1, volume1Des, status1);
+
+    // Send some data but not enough to trigger the notification 
+    TUint currentVol(0);
+    while (currentVol < threshold1 / 2)
+        {
+        err = TestUdpDataPathL(sock1, iDummyNifSendAddr, KSmallBufferLength);
+        TESTEL(KErrNone == err, err);
+        TESTEL(KRequestPending == status1.Int(), status1.Int());
+        currentVol += KSmallBufferUdpTestPacketSize;
+        }
+
+    INFO_PRINTF1(_L("First DataSentNotificationRequest still outstanding (as expected) - now cancelling"));
+
+    // Cancel the request and expect the completion
+    conn1.DataSentNotificationCancel();
+    User::WaitForRequest(status1);
+    TESTEL(status1.Int() == KErrCancel, status1.Int());
+
+    INFO_PRINTF1(_L("First DataSentNotificationRequest completed with KErrCancel"));
+    
+    // The first cancellation has worked, repeat the above steps for the second cancellation
+    INFO_PRINTF1(_L("Second DataSentNotificationRequest"));
+    conn1.DataSentNotificationRequest(threshold1, volume1Des, status1);
+
+    // NOTE: It is a deliberate that no data is transfered this time.
+	//       Transmitting data and crossing the threshold for the first (cancelled) notification
+	//       would cause the object to be cleaned up and therefore mask this issue
+    
+    // Cancel the request and expect the completion
+    conn1.DataSentNotificationCancel();
+    User::WaitForRequest(status1);
+    TESTEL(status1.Int() == KErrCancel, status1.Int());
+    INFO_PRINTF1(_L("Second DataSentNotificationRequest completed with KErrCancel"));
+    
+    // NOTE: Reaching here successfully does NOT mean the test has passed. If the data monitoring structures
+    //       have been left behind esock will panic when the connection is stopped  
+    
+    
+    //********** turn the idle timers back on now we are finished ***********
+    err = conn1.SetOpt(KCOLProvider, KConnDisableTimers, EFalse);
+    TESTEL(KErrNone == err, err);
+
+    //********** clean up ***********
+    DestroyUdpSocket(sock1);
+    CleanupStack::Pop(&sock1);
+
+    err = conn1.Stop();
+    TESTEL(KErrNone == err, err);
+
+    CloseConnection(conn1);
+    CleanupStack::Pop(&conn1);
+
+    CloseSocketServer(ss);
+    CleanupStack::Pop(&ss);
+
+    return TestStepResult();
+
+} // TE_RConnectionTest481
+
+
+
+enum TVerdict TE_RConnectionTest482::doTestStepL(void)
+/**
+ * Test 482
+ * Test DataReceivedNotificationRequest() cancellation
+ * Added for defect ou1cimx1#305124.
+ * Tests that cancellation of the request does indeed cancel the request
+ * Defect summary: was the case that the first cancel cancelled the request but left
+ * a notification structure in existence. The second cancel would see the structure
+ * and think that the cancellation had already been done leaving the request outstanding.
+ * @return enum TVerdict Indicates status of test run. See INFO_PRINTF1.h for possible values
+ */
+{
+    TInt err;
+    TRequestStatus status1;
+
+    RSocketServ ss;
+    err = OpenSocketServer(ss);
+    TESTEL(KErrNone == err, err);
+    CleanupClosePushL(ss);
+
+    //********** connection creation ***********
+    RConnection conn1;
+    err = OpenConnection(conn1, ss);
+    TESTEL(KErrNone == err, err);
+    CleanupClosePushL(conn1);
+
+    // start the dummynif
+    err = StartConnectionWithOverrides(conn1, iDummyNifLongTimeoutIap);
+    TESTEL(KErrNone == err, err);
+    err = conn1.SetOpt(KCOLProvider, KConnDisableTimers, ETrue);
+    TESTEL(KErrNone == err, err);
+
+    RSocket sock1;
+    err = OpenUdpSocketExplicitL(sock1, ss, conn1);
+    TESTEL(KErrNone == err, err);
+    CleanupClosePushL(sock1);
+
+    INFO_PRINTF1(_L("First DataReceivedNotificationRequest"));
+    // Request DataSentNotificationRequest
+    TUint volume1(0); 
+    TPckg<TUint> volume1Des(volume1);
+    TUint threshold1(KLowThresholdSize);
+    conn1.DataReceivedNotificationRequest(threshold1, volume1Des, status1);
+
+    // Send some data but not enough to trigger the notification 
+    TUint currentVol(0);
+    while (currentVol < threshold1 / 2)
+        {
+        err = TestUdpDataPathL(sock1, iDummyNifSendAddr, KSmallBufferLength);
+        TESTEL(KErrNone == err, err);
+        TESTEL(KRequestPending == status1.Int(), status1.Int());
+        currentVol += KSmallBufferUdpTestPacketSize;
+        }
+
+    INFO_PRINTF1(_L("First DataReceivedNotificationRequest still outstanding (as expected) - now cancelling"));
+
+    // Cancel the request and expect the completion
+    conn1.DataReceivedNotificationCancel();
+    User::WaitForRequest(status1);
+    TESTEL(status1.Int() == KErrCancel, status1.Int());
+
+    INFO_PRINTF1(_L("First DataReceivedNotificationRequest completed with KErrCancel"));
+    
+    // The first cancellation has worked, repeat the above steps for the second cancellation
+    INFO_PRINTF1(_L("Second DataReceivedNotificationRequest"));
+    conn1.DataReceivedNotificationRequest(threshold1, volume1Des, status1);
+
+    // NOTE: It is a deliberate that no data is transfered this time.
+	//       Transmitting data and crossing the threshold for the first (cancelled) notification
+	//       would cause the object to be cleaned up and therefore mask this issue
+    
+    // Cancel the request and expect the completion
+    conn1.DataReceivedNotificationCancel();
+    User::WaitForRequest(status1);
+    TESTEL(status1.Int() == KErrCancel, status1.Int());
+    INFO_PRINTF1(_L("Second DataReceivedNotificationRequest completed with KErrCancel"));
+
+    // NOTE: Reaching here successfully does NOT mean the test has passed. If the data monitoring structures
+    //       have been left behind esock will panic when the connection is stopped  
+
+    
+    //********** turn the idle timers back on now we are finished ***********
+    err = conn1.SetOpt(KCOLProvider, KConnDisableTimers, EFalse);
+    TESTEL(KErrNone == err, err);
+
+    //********** clean up ***********
+    DestroyUdpSocket(sock1);
+    CleanupStack::Pop(&sock1);
+
+    err = conn1.Stop();
+    TESTEL(KErrNone == err, err);
+
+    CloseConnection(conn1);
+    CleanupStack::Pop(&conn1);
+
+    CloseSocketServer(ss);
+    CleanupStack::Pop(&ss);
+
+    return TestStepResult();
+
+} // TE_RConnectionTest482
+
+
+
+enum TVerdict TE_RConnectionTest483::doTestStepL(void)
+/**
+ * Test 483
+ * Test DataSentNotificationRequest() cancellation
+ * Added for defect ou1cimx1#305124.
+ * Tests that cancellation of the request does indeed cancel the request
+ * Defect summary: If the state described in Test481 occurs, it would have been possible to
+ * request more than one DataSentNotificationRequest per RConnection. This should not be possible.
+ * @return enum TVerdict Indicates status of test run. See INFO_PRINTF1.h for possible values
+ */
+{
+    TInt err;
+    TRequestStatus status1;
+
+    RSocketServ ss;
+    err = OpenSocketServer(ss);
+    TESTEL(KErrNone == err, err);
+    CleanupClosePushL(ss);
+
+    //********** connection creation ***********
+    RConnection conn1;
+    err = OpenConnection(conn1, ss);
+    TESTEL(KErrNone == err, err);
+    CleanupClosePushL(conn1);
+
+    // start the dummynif
+    err = StartConnectionWithOverrides(conn1, iDummyNifLongTimeoutIap);
+    TESTEL(KErrNone == err, err);
+    err = conn1.SetOpt(KCOLProvider, KConnDisableTimers, ETrue);
+    TESTEL(KErrNone == err, err);
+
+    RSocket sock1;
+    err = OpenUdpSocketExplicitL(sock1, ss, conn1);
+    TESTEL(KErrNone == err, err);
+    CleanupClosePushL(sock1);
+
+    INFO_PRINTF1(_L("First DataSentNotificationRequest"));
+    // Request DataSentNotificationRequest
+    TUint volume1(0); 
+    TPckg<TUint> volume1Des(volume1);
+    TUint threshold1(KLowThresholdSize);
+    conn1.DataSentNotificationRequest(threshold1, volume1Des, status1);
+
+    // Send some data but not enough to trigger the notification 
+    TUint currentVol(0);
+    while (currentVol < threshold1 / 2)
+        {
+        err = TestUdpDataPathL(sock1, iDummyNifSendAddr, KSmallBufferLength);
+        TESTEL(KErrNone == err, err);
+        TESTEL(KRequestPending == status1.Int(), status1.Int());
+        currentVol += KSmallBufferUdpTestPacketSize;
+        }
+
+    INFO_PRINTF1(_L("First DataSentNotificationRequest still outstanding (as expected) - now cancelling"));
+
+    // Cancel the request and expect the completion
+    conn1.DataSentNotificationCancel();
+    User::WaitForRequest(status1);
+    TESTEL(status1.Int() == KErrCancel, status1.Int());
+
+    INFO_PRINTF1(_L("First DataSentNotificationRequest completed with KErrCancel"));
+    
+    // The first cancellation has worked, repeat the above steps for the second cancellation
+    INFO_PRINTF1(_L("Second DataSentNotificationRequest"));
+    conn1.DataSentNotificationRequest(threshold1, volume1Des, status1);
+
+    // NOTE: It is a deliberate that no data is transfered this time.
+	//       Transmitting data and crossing the threshold for the first (cancelled) notification
+	//       would cause the object to be cleaned up and therefore mask this issue
+    
+    // Cancel the request and expect the completion
+    conn1.DataSentNotificationCancel();
+    User::WaitForRequest(status1);
+    TESTEL(status1.Int() == KErrCancel, status1.Int());
+    INFO_PRINTF1(_L("Second DataSentNotificationRequest completed with KErrCancel"));
+    
+    
+    INFO_PRINTF1(_L("Third DataSentNotificationRequest"));
+    conn1.DataSentNotificationRequest(threshold1, volume1Des, status1);
+    
+
+    INFO_PRINTF1(_L("Fourth DataSentNotificationRequest"));
+    TRequestStatus status2;
+    conn1.DataSentNotificationRequest(threshold1, volume1Des, status2);
+    TBool requestCompleted = WaitForRequestOrTimeOutL(status2, KOneSecondDelay);
+    TESTL(requestCompleted);
+    TESTEL(status2.Int() == KErrInUse, status2.Int());
+    INFO_PRINTF1(_L("Fourth DataSentNotificationRequest failed with KErrInUse as expected"));
+    
+    conn1.DataSentNotificationCancel();
+    User::WaitForRequest(status1);
+    TESTEL(status1.Int() == KErrCancel, status1.Int());
+    INFO_PRINTF1(_L("Third DataSentNotificationRequest completed with KErrCancel"));
+    
+    //********** turn the idle timers back on now we are finished ***********
+    err = conn1.SetOpt(KCOLProvider, KConnDisableTimers, EFalse);
+    TESTEL(KErrNone == err, err);
+
+    //********** clean up ***********
+    DestroyUdpSocket(sock1);
+    CleanupStack::Pop(&sock1);
+
+    err = conn1.Stop();
+    TESTEL(KErrNone == err, err);
+
+    CloseConnection(conn1);
+    CleanupStack::Pop(&conn1);
+
+    CloseSocketServer(ss);
+    CleanupStack::Pop(&ss);
+
+    return TestStepResult();
+
+} // TE_RConnectionTest483
+
+
+enum TVerdict TE_RConnectionTest484::doTestStepL(void)
+/**
+ * Test 484
+ * Test DataReceivedNotificationRequest() cancellation
+ * Added for defect ou1cimx1#305124.
+ * Tests that cancellation of the request does indeed cancel the request
+ * Defect summary: If the state described in Test482 occurs, it would have been possible to
+ * request more than one DataReceivedNotificationRequest per RConnection. This should not be possible.
+ * @return enum TVerdict Indicates status of test run. See INFO_PRINTF1.h for possible values
+ */
+{
+    TInt err;
+    TRequestStatus status1;
+
+    RSocketServ ss;
+    err = OpenSocketServer(ss);
+    TESTEL(KErrNone == err, err);
+    CleanupClosePushL(ss);
+
+    //********** connection creation ***********
+    RConnection conn1;
+    err = OpenConnection(conn1, ss);
+    TESTEL(KErrNone == err, err);
+    CleanupClosePushL(conn1);
+
+    // start the dummynif
+    err = StartConnectionWithOverrides(conn1, iDummyNifLongTimeoutIap);
+    TESTEL(KErrNone == err, err);
+    err = conn1.SetOpt(KCOLProvider, KConnDisableTimers, ETrue);
+    TESTEL(KErrNone == err, err);
+
+    RSocket sock1;
+    err = OpenUdpSocketExplicitL(sock1, ss, conn1);
+    TESTEL(KErrNone == err, err);
+    CleanupClosePushL(sock1);
+
+    INFO_PRINTF1(_L("First DataReceivedNotificationRequest"));
+    // Request DataReceivedNotificationRequest
+    TUint volume1(0); 
+    TPckg<TUint> volume1Des(volume1);
+    TUint threshold1(KLowThresholdSize);
+    conn1.DataReceivedNotificationRequest(threshold1, volume1Des, status1);
+
+    // Send some data but not enough to trigger the notification 
+    TUint currentVol(0);
+    while (currentVol < threshold1 / 2)
+        {
+        err = TestUdpDataPathL(sock1, iDummyNifSendAddr, KSmallBufferLength);
+        TESTEL(KErrNone == err, err);
+        TESTEL(KRequestPending == status1.Int(), status1.Int());
+        currentVol += KSmallBufferUdpTestPacketSize;
+        }
+
+    INFO_PRINTF1(_L("First DataReceivedNotificationRequest still outstanding (as expected) - now cancelling"));
+
+    // Cancel the request and expect the completion
+    conn1.DataReceivedNotificationCancel();
+    User::WaitForRequest(status1);
+    TESTEL(status1.Int() == KErrCancel, status1.Int());
+
+    INFO_PRINTF1(_L("First DataReceivedNotificationRequest completed with KErrCancel"));
+    
+    // The first cancellation has worked, repeat the above steps for the second cancellation
+    INFO_PRINTF1(_L("Second DataReceivedNotificationRequest"));
+    conn1.DataReceivedNotificationRequest(threshold1, volume1Des, status1);
+
+    // NOTE: It is a deliberate that no data is transfered this time.
+	//       Transmitting data and crossing the threshold for the first (cancelled) notification
+	//       would cause the object to be cleaned up and therefore mask this issue
+    
+    // Cancel the request and expect the completion
+    conn1.DataReceivedNotificationCancel();
+    User::WaitForRequest(status1);
+    TESTEL(status1.Int() == KErrCancel, status1.Int());
+    INFO_PRINTF1(_L("Second DataReceivedNotificationRequest completed with KErrCancel"));
+    
+    
+    INFO_PRINTF1(_L("Third DataReceivedNotificationRequest"));
+    conn1.DataReceivedNotificationRequest(threshold1, volume1Des, status1);
+
+    INFO_PRINTF1(_L("Fourth DataReceivedNotificationRequest"));
+    TRequestStatus status2;
+    conn1.DataReceivedNotificationRequest(threshold1, volume1Des, status2);
+    TBool requestCompleted = WaitForRequestOrTimeOutL(status2, KOneSecondDelay);
+    TESTL(requestCompleted);
+    TESTEL(status2.Int() == KErrInUse, status2.Int());
+    INFO_PRINTF1(_L("Fourth DataReceivedNotificationRequest failed with KErrInUse as expected"));
+    
+    conn1.DataReceivedNotificationCancel();
+    User::WaitForRequest(status1);
+    TESTEL(status1.Int() == KErrCancel, status1.Int());
+    INFO_PRINTF1(_L("Third DataReceivedNotificationRequest completed with KErrCancel"));
+    
+    //********** turn the idle timers back on now we are finished ***********
+    err = conn1.SetOpt(KCOLProvider, KConnDisableTimers, EFalse);
+    TESTEL(KErrNone == err, err);
+
+    //********** clean up ***********
+    DestroyUdpSocket(sock1);
+    CleanupStack::Pop(&sock1);
+
+    err = conn1.Stop();
+    TESTEL(KErrNone == err, err);
+
+    CloseConnection(conn1);
+    CleanupStack::Pop(&conn1);
+
+    CloseSocketServer(ss);
+    CleanupStack::Pop(&ss);
+
+    return TestStepResult();
+
+} // TE_RConnectionTest484
+
+
 // EOF TE_RConnectionCMM.cpp
 
--- a/datacommsserver/esockserver/test/TE_RConnectionSuite/src/TE_RConnectionDummyNifTestSteps.cpp	Fri Apr 16 16:15:03 2010 +0300
+++ b/datacommsserver/esockserver/test/TE_RConnectionSuite/src/TE_RConnectionDummyNifTestSteps.cpp	Mon May 03 13:39:24 2010 +0300
@@ -232,7 +232,6 @@
 void CConnectionTest1b::Start()
 	{
 	INFO_PRINTF1(_L("Starting Connection"));
-
 	iConnection.Start(iStatus);
 	SetActive();
 	}
@@ -1948,6 +1947,10 @@
 
 	TESTEL(KErrNone == progress().iError, progress().iError);
 	TESTEL(ECsdStartingHangUp == progress().iStage, progress().iStage);
+	
+	INFO_PRINTF1(_L("Waiting for KConnectionDown and KConnectionUninitialised. If the test times-out they didn't come (in the right seq)."));
+    WaitForRelevantProgress(conn1, progress, KConnectionDown);
+    WaitForRelevantProgress(conn1, progress, KConnectionUninitialised); 
 
 	CloseConnection(conn1);
 	CleanupStack::Pop();
@@ -5088,6 +5091,10 @@
 
 	TESTEL(KErrNone == progress().iError, progress().iError);
 	TESTEL(ECsdStartingHangUp == progress().iStage, progress().iStage);
+	
+    INFO_PRINTF1(_L("Waiting for KConnectionDown and KConnectionUninitialised. If the test times-out they didn't come (in the right seq)."));	
+    WaitForRelevantProgress(conn1, progress, KConnectionDown);
+    WaitForRelevantProgress(conn1, progress, KConnectionUninitialised);	
 
 	CloseConnection(conn1);
 	CleanupStack::Pop();
--- a/datacommsserver/esockserver/test/TE_RConnectionSuite/src/TE_RConnectionStep.cpp	Fri Apr 16 16:15:03 2010 +0300
+++ b/datacommsserver/esockserver/test/TE_RConnectionSuite/src/TE_RConnectionStep.cpp	Mon May 03 13:39:24 2010 +0300
@@ -1732,6 +1732,27 @@
 }
 
 
+TBool TE_RConnectionStep::WaitForRequestOrTimeOutL(TRequestStatus& aStatus, TInt aTimeOut)
+    {
+    RTimer timer;
+    User::LeaveIfError(timer.CreateLocal());
+
+    TRequestStatus timerStatus;
+    timer.After(timerStatus, aTimeOut);
+    User::WaitForRequest(aStatus, timerStatus);
+    TBool requestCompleted = EFalse;
+    
+    if (timerStatus == KRequestPending)
+        {
+        timer.Cancel();
+        User::WaitForRequest(timerStatus);
+        requestCompleted = ETrue;
+        }
+    
+    timer.Close();
+    return requestCompleted;
+    }
+
 
 /*
  * Now the stuff for the peculiar tests that need to use QoS
--- a/datacommsserver/esockserver/test/TE_RConnectionSuite/src/TE_RConnectionSuite.cpp	Fri Apr 16 16:15:03 2010 +0300
+++ b/datacommsserver/esockserver/test/TE_RConnectionSuite/src/TE_RConnectionSuite.cpp	Mon May 03 13:39:24 2010 +0300
@@ -655,6 +655,14 @@
 		testStep=new TE_RConnectionTest479();
 	else if(aStepName.Compare(_L("Test480")) == 0)
 		testStep=new TE_RConnectionTest480();
+    else if(aStepName.Compare(_L("Test481")) == 0)
+        testStep=new TE_RConnectionTest481();
+    else if(aStepName.Compare(_L("Test482")) == 0)
+        testStep=new TE_RConnectionTest482();
+    else if(aStepName.Compare(_L("Test483")) == 0)
+        testStep=new TE_RConnectionTest483();
+    else if(aStepName.Compare(_L("Test484")) == 0)
+        testStep=new TE_RConnectionTest484();
 
 	return testStep;
 	}
--- a/datacommsserver/esockserver/test/util/src/te_esockutilsteps.cpp	Fri Apr 16 16:15:03 2010 +0300
+++ b/datacommsserver/esockserver/test/util/src/te_esockutilsteps.cpp	Mon May 03 13:39:24 2010 +0300
@@ -17,6 +17,7 @@
 #include <test/testexecutelog.h>
 #include "esocktestutils.h"
 #include <es_sock.h>
+#include <comms-infras/es_availability.h>
 
 #include <e32base.h>
 #include <cinidata.h>
@@ -149,6 +150,16 @@
 		}
 #endif
 		
+	// Explicitly reset pubsub keys used for controlling bearer availability during testing
+	const TInt KMaxLikelyAvailabilityAccessPoints = 32;
+	const TInt KDummyNifTestingPubSubUid = 0x10272F42;
+	INFO_PRINTF1(_L("Resetting availability pubsub keys"));
+	for(TInt i = 0; i < KMaxLikelyAvailabilityAccessPoints; i++)
+		{
+		// Harmless if the key doesn't exist - so we can ignore the return code
+		RProperty::Set(TUid::Uid(KDummyNifTestingPubSubUid), i, ESock::TAvailabilityStatus::EMaxAvailabilityScore);
+		}
+	
 	return TestStepResult();
 	}
 
--- a/datacommsserver/esockserver/test/util/src/ts_esockutilsteps.cpp	Fri Apr 16 16:15:03 2010 +0300
+++ b/datacommsserver/esockserver/test/util/src/ts_esockutilsteps.cpp	Mon May 03 13:39:24 2010 +0300
@@ -14,6 +14,7 @@
 //
 
 // EPOC includes
+#include <e32property.h>
 #include <e32base.h>
 
 // Test system includes
@@ -24,6 +25,7 @@
 #include "ts_esockutilsteps.h"
 #include "esockloader.h"
 #include "esocktestutils.h"
+#include <comms-infras/es_availability.h>
 
 class TTruncateOverflow16 : public TDes16Overflow
 	{
@@ -155,6 +157,17 @@
 			INFO_PRINTF2(_L("UnloadESock returned error %d"), err);
 			}
 		}
+
+	// Explicitly reset pubsub keys used for controlling bearer availability during testing
+	const TInt KMaxLikelyAvailabilityAccessPoints = 32;
+	const TInt KDummyNifTestingPubSubUid = 0x10272F42;
+	INFO_PRINTF1(_L("Resetting availability pubsub keys"));
+	for(TInt i = 0; i < KMaxLikelyAvailabilityAccessPoints; i++)
+		{
+		// Harmless if the key doesn't exist - so we can ignore the return code
+		RProperty::Set(TUid::Uid(KDummyNifTestingPubSubUid), i, ESock::TAvailabilityStatus::EMaxAvailabilityScore);
+		}
+	
 	return verdict;
 	}