Revision: 201035 RCL_3
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 14 Sep 2010 23:38:38 +0300
branchRCL_3
changeset 27 5ebd530e523b
parent 26 b564fb5fd78b
Revision: 201035 Kit: 201035
datacommsserver/esockserver/core_states/ss_corepractivities.cpp
datacommsserver/esockserver/inc/ss_sapshim.h
datacommsserver/esockserver/ssock/ss_rmetaextensioncontainer.cpp
datacommsserver/esockserver/ssock/ss_sapshim.cpp
datacommsserver/esockserver/test/te_mecunittest/group/scripts/te_mecunittest.script
datacommsserver/esockserver/test/te_mecunittest/group/te_mecunittest.mmp
datacommsserver/esockserver/test/te_mecunittest/inc/mectest013step.h
datacommsserver/esockserver/test/te_mecunittest/inc/mectest014step.h
datacommsserver/esockserver/test/te_mecunittest/src/mectest013step.cpp
datacommsserver/esockserver/test/te_mecunittest/src/mectest014step.cpp
datacommsserver/esockserver/test/te_mecunittest/src/mecunittestserver.cpp
--- a/datacommsserver/esockserver/core_states/ss_corepractivities.cpp	Wed Sep 01 12:35:48 2010 +0100
+++ b/datacommsserver/esockserver/core_states/ss_corepractivities.cpp	Tue Sep 14 23:38:38 2010 +0300
@@ -2041,7 +2041,7 @@
 	{
  	TInt cntrlClients = iContext.Node().CountClients<TDefaultClientMatchPolicy>(
  								/*include*/TClientType(TCFClientType::ECtrl));
- 	if (cntrlClients > 0 &&
+ 	if (cntrlClients == 0 &&
  		iContext.Node().ServiceProvider() &&
  		!(iContext.Node().ServiceProvider()->Flags() & TCFClientType::EStarted))
  		{
--- a/datacommsserver/esockserver/inc/ss_sapshim.h	Wed Sep 01 12:35:48 2010 +0100
+++ b/datacommsserver/esockserver/inc/ss_sapshim.h	Tue Sep 14 23:38:38 2010 +0300
@@ -231,7 +231,6 @@
 	SAP_FLAG_FUNCTIONS(UseBearerErrors, EUseBearerErrors)
 
 	void HostResolverSpecificUnbind();
-
 private:
 	CServProviderBase* iProvider;
 	//CHostResolver specific workaround for now
--- a/datacommsserver/esockserver/ssock/ss_rmetaextensioncontainer.cpp	Wed Sep 01 12:35:48 2010 +0100
+++ b/datacommsserver/esockserver/ssock/ss_rmetaextensioncontainer.cpp	Tue Sep 14 23:38:38 2010 +0300
@@ -67,15 +67,24 @@
 
 EXPORT_C const Meta::SMetaData* RMetaExtensionContainerC::FindExtension(const Meta::STypeId& aTypeId) const
     {
-    __ASSERT_ALWAYS(iContainerImpl, PanicMec(ENoImplementation));
-    return iContainerImpl->FindExtension(aTypeId);
+    if (Container())
+        {
+        return Container()->FindExtension(aTypeId);
+        }
+    else
+        {
+        return NULL;
+        }
     }
 
 
 EXPORT_C const Meta::SMetaData& RMetaExtensionContainerC::FindExtensionL(const Meta::STypeId& aTypeId) const
     {
-    __ASSERT_ALWAYS(iContainerImpl, PanicMec(ENoImplementation));
-    return iContainerImpl->FindExtensionL(aTypeId);
+    if (!Container())
+        {
+        User::Leave(KErrNotFound);
+        }
+    return Container()->FindExtensionL(aTypeId);
     }
 
 
--- a/datacommsserver/esockserver/ssock/ss_sapshim.cpp	Wed Sep 01 12:35:48 2010 +0100
+++ b/datacommsserver/esockserver/ssock/ss_sapshim.cpp	Tue Sep 14 23:38:38 2010 +0300
@@ -104,7 +104,7 @@
 
 MLowerDataSender::TSendResult CTransportFlowShim::Send(RMBufChain& /*aData*/)
     {
-    __ASSERT_DEBUG(iHostResolverNotify, User::Panic(KSpecAssert_ESockSSocksspshm, 3));
+    __ASSERT_DEBUG(IsHostResolver(), User::Panic(KSpecAssert_ESockSSocksspshm, 3));
 
     TBuf8<sizeof(TConnectionInfo)> buf;
     if (Control(KSOLProvider, static_cast<TUint>(KSoConnectionInfo), buf) == KErrNone)
@@ -270,9 +270,7 @@
 
 void CTransportFlowShim::HostResolverSpecificUnbind()
 	{
-	// Can't have both HR & SAP
 	__ASSERT_DEBUG(!iProvider, User::Panic(KSpecAssert_ESockSSocksspshm, 9));
-
 	if(iSubConnectionProvider.IsOpen())
 		{
 		iSessionControlNotify = NULL;
@@ -289,7 +287,6 @@
 		DeleteThisFlow();
 		}
 	}
-
 void CTransportFlowShim::Unbind()
     {
 	LOG( ESockLog::Printf(_L8("CTransportFlowShim %08x:\tUnbind()"), this) );
@@ -301,29 +298,32 @@
 		return;
 		}
 
-	// Legacy support for host resolvers involves a separate north bound MUpperControl interface
-	if(iHostResolverNotify)
+	// Legacy support for host resolvers
+	if(IsHostResolver())
 		{
 		HostResolverSpecificUnbind();
-		}
-	else
-		{
-		if (iProvider)
+
+			}
+		else
 			{
-			iProvider->SetNotify(NULL);
 
-			if (!Detaching())
-				{
-				delete iProvider;
-				iProvider = NULL;
-				}
+	if (iProvider)
+		{
+		iProvider->SetNotify(NULL);
+
+		if (!Detaching())
+			{
+			delete iProvider;
+			iProvider = NULL;
 			}
+		}
 
 #ifdef SYMBIAN_NETWORKING_UPS
-		// Hook for derived classes to do cleanup before unbind occurs
-		PreUnbind();
+	// Hook for derived classes to do cleanup before unbind occurs
+	PreUnbind();
 #endif
-		CNetworkFlow::Unbind();
+
+	CNetworkFlow::Unbind();
 		}
     }
 
@@ -1336,7 +1336,7 @@
 		LOG( ESockLog::Printf(_L("CTransportFlowShim %08x:\tSubConnectionError() - calling Error() function"), this) );
     	Error(errorMsg.iValue, anOperationMask);
 	    }
-	else if (iHostResolverNotify)
+	else if (IsHostResolver())
 	    {
 		LOG( ESockLog::Printf(_L("CTransportFlowShim %08x:\tSubConnectionError() - passing to host resolver's Error() function"), this) );
 	    iHostResolverNotify->Error(errorMsg.iValue);
@@ -1374,7 +1374,7 @@
 		
 		__ASSERT_DEBUG(iSubConnectionProvider.IsOpen(), User::Panic(KSpecAssert_ESockSSocksspshm, 48));	// legacy flows have no control side; should never get here
 		}
-	else if (iHostResolverNotify)
+	else if (IsHostResolver())
 	    {//workaroud to indicate to CHostResolver we've got connection info
 	    if (!aBindTo.iNodeId.Ptr())
 	        {
@@ -1433,7 +1433,7 @@
 
         // A held-over implicit resolution request will now work (if it ever will).
 		// Explicit host resolver requests have already been re-issued in BindToL().
-        if (iHostResolverNotify && (iFlowParams.iFlowRequestType != TFlowParams::EExplicitConnection))
+        if (IsHostResolver() && (iFlowParams.iFlowRequestType != TFlowParams::EExplicitConnection))
 	        {
     	    iHostResolverNotify->StartSending();
 	        }
@@ -1461,13 +1461,16 @@
 	// RConnection but not transferring any data will not cause the TCP/IP stack to attach the flow
 	// to the route and hence not call Error() if the interface comes down.
 
-	if (IsBoundToSession() && aMessage.iValue == KErrForceDisconnected)
+	TInt err = (aMessage.iValue == KErrForceDisconnected) ? KErrDisconnected : aMessage.iValue;
+	if (IsBoundToSession() && (aMessage.iValue == KErrForceDisconnected || !UseBearerErrors()))
 		{
-		Error(KErrDisconnected, EErrorAllOperations);
+		Error(err, EErrorAllOperations);
 		}
-	else if (IsBoundToSession() && !UseBearerErrors())
+	else if (IsHostResolver())
 	    {
-    	Error(aMessage.iValue, EErrorAllOperations);
+        __ASSERT_DEBUG(err != KErrNone, User::Panic(KSpecAssert_ESockSSocksspshm, 67));
+        LOG( ESockLog::Printf(_L("CTransportFlowShim %08x:\tStopFlow() - passing to host resolver's Error() function"), this) );
+        iHostResolverNotify->Error(err);
 	    }
 
 	if (iLowerFlow)
--- a/datacommsserver/esockserver/test/te_mecunittest/group/scripts/te_mecunittest.script	Wed Sep 01 12:35:48 2010 +0100
+++ b/datacommsserver/esockserver/test/te_mecunittest/group/scripts/te_mecunittest.script	Tue Sep 14 23:38:38 2010 +0300
@@ -200,6 +200,26 @@
 END_TESTCASE            MEC_UNIT_TEST_012
 
 
+START_TESTCASE          MEC_UNIT_TEST_013
+//! @SYMTestCaseID      MEC_UNIT_TEST_013
+//! @SYMTestCaseDesc    Test NULL return for RMetaExtensionContainerC::FindExtension() with un-opened container
+//! @SYMFssID           COMMS-INFRAS/Esock/MetaExtensionContainer/UnitTest
+//! @SYMTestActions     1) FindExtension T1 in constMec
+//! @SYMTestExpectedResults  NULL return code
+RUN_TEST_STEP           60 te_mecunittest MecTest013
+END_TESTCASE            MEC_UNIT_TEST_013
+
+
+START_TESTCASE          MEC_UNIT_TEST_014
+//! @SYMTestCaseID      MEC_UNIT_TEST_014
+//! @SYMTestCaseDesc    Test KErrNotFound leave for RMetaExtensionContainerC::FindExtensionL() with un-opened container
+//! @SYMFssID           COMMS-INFRAS/Esock/MetaExtensionContainer/UnitTest
+//! @SYMTestActions     1) FindExtensionL T1 in constMec
+//! @SYMTestExpectedResults  Leaves with KErrNotFound
+RUN_TEST_STEP           60 te_mecunittest MecTest014
+END_TESTCASE            MEC_UNIT_TEST_014
+
+
 ////////////////////////////////////////////////
 // Container Branching Tests
 ////////////////////////////////////////////////
@@ -488,30 +508,6 @@
 END_TESTCASE            MEC_UNIT_TEST_104
 
 
-START_TESTCASE          MEC_UNIT_TEST_105
-//! @SYMTestCaseID      MEC_UNIT_TEST_105
-//! @SYMTestCaseDesc 	Test Panic mecpanic:1 (ENoImplementation) for RMetaExtensionContainerC::FindExtension()
-//! @SYMFssID 			COMMS-INFRAS/Esock/MetaExtensionContainer/UnitTest
-//! @SYMTestActions 	1) FindExtension T1 in constMec
-//! @SYMTestExpectedResults  Panic mecpanic:1
-//! @SYMTestPriority 	Critical
-//! @SYMTestStatus 		Implemented
-RUN_PANIC_STEP_RESULT 	1 mecpanic  60 te_mecunittest MecTestPanic5
-END_TESTCASE            MEC_UNIT_TEST_105
-
-
-START_TESTCASE          MEC_UNIT_TEST_106
-//! @SYMTestCaseID      MEC_UNIT_TEST_106
-//! @SYMTestCaseDesc 	Test Panic mecpanic:1 (ENoImplementation) for RMetaExtensionContainerC::FindExtensionL()
-//! @SYMFssID 			COMMS-INFRAS/Esock/MetaExtensionContainer/UnitTest
-//! @SYMTestActions 	1) FindExtensionL T1 in constMec
-//! @SYMTestExpectedResults  Panic mecpanic:1
-//! @SYMTestPriority 	Critical
-//! @SYMTestStatus 		Implemented
-RUN_PANIC_STEP_RESULT 	1 mecpanic  60 te_mecunittest MecTestPanic6
-END_TESTCASE            MEC_UNIT_TEST_106
-
-
 START_TESTCASE          MEC_UNIT_TEST_107
 //! @SYMTestCaseID      MEC_UNIT_TEST_107
 //! @SYMTestCaseDesc 	Test Panic mecpanic:3 (EAlreadyOpen) for RMetaExtensionContainer::Open()
--- a/datacommsserver/esockserver/test/te_mecunittest/group/te_mecunittest.mmp	Wed Sep 01 12:35:48 2010 +0100
+++ b/datacommsserver/esockserver/test/te_mecunittest/group/te_mecunittest.mmp	Tue Sep 14 23:38:38 2010 +0300
@@ -54,6 +54,8 @@
 SOURCE          mectest010step.cpp
 SOURCE          mectest011step.cpp
 SOURCE          mectest012step.cpp
+SOURCE          mectest013step.cpp
+SOURCE          mectest014step.cpp
 
 SOURCE			mectest030step.cpp
 SOURCE          mectest031step.cpp
@@ -71,8 +73,6 @@
 SOURCE          mectestpanic2step.cpp
 SOURCE          mectestpanic3step.cpp
 SOURCE          mectestpanic4step.cpp
-SOURCE          mectestpanic5step.cpp
-SOURCE			mectestpanic6step.cpp
 SOURCE			mectestpanic7step.cpp
 SOURCE			mectestpanic8step.cpp
 SOURCE			mectestpanic9step.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/datacommsserver/esockserver/test/te_mecunittest/inc/mectest013step.h	Tue Sep 14 23:38:38 2010 +0300
@@ -0,0 +1,49 @@
+// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+// mectest013step.h
+//
+
+/**
+@file
+*/
+
+
+#ifndef MECTEST013STEP_H
+#define MECTEST013STEP_H
+
+#include "mecunitteststepbase.h"
+
+
+_LIT(KMecTest013Step, "MecTest013");
+
+
+class CMecTest013Step : public CMecUnitTestStepBase
+	{
+public:
+	virtual ~CMecTest013Step();
+
+public:
+    explicit CMecTest013Step()
+        : CMecUnitTestStepBase(KMecTest013Step)
+        {
+        }
+
+    virtual TVerdict RunTestStepL();
+    };
+  
+#endif
+// MECTEST013STEP_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/datacommsserver/esockserver/test/te_mecunittest/inc/mectest014step.h	Tue Sep 14 23:38:38 2010 +0300
@@ -0,0 +1,49 @@
+// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+// mectest014step.h
+//
+
+/**
+@file
+*/
+
+
+#ifndef MECTEST014STEP_H
+#define MECTEST014STEP_H
+
+#include "mecunitteststepbase.h"
+
+
+_LIT(KMecTest014Step, "MecTest014");
+
+
+class CMecTest014Step : public CMecUnitTestStepBase
+	{
+public:
+	virtual ~CMecTest014Step();
+
+public:
+    explicit CMecTest014Step()
+        : CMecUnitTestStepBase(KMecTest014Step)
+        {
+        }
+
+    virtual TVerdict RunTestStepL();
+    };
+  
+#endif
+// MECTEST014STEP_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/datacommsserver/esockserver/test/te_mecunittest/src/mectest013step.cpp	Tue Sep 14 23:38:38 2010 +0300
@@ -0,0 +1,48 @@
+// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+// mectest013step.cpp
+//
+
+/**
+@file
+*/
+
+#include "mectest013step.h"
+#include "testextensions.h"
+#include "metaextensioncontainerspy.h"
+#include <comms-infras/ss_rmetaextensioncontainer.h>
+#include <comms-infras/ss_commsprov.h>
+
+using namespace ESock;
+
+CMecTest013Step::~CMecTest013Step()
+    {
+    }
+
+
+/**
+//! @SYMTestCaseID      MEC_UNIT_TEST_013
+//! @SYMTestCaseDesc    Test NULL return for RMetaExtensionContainerC::FindExtension() with un-opened container
+//! @SYMFssID           COMMS-INFRAS/Esock/MetaExtensionContainer/UnitTest
+//! @SYMTestActions     1) FindExtension T1 in constMec
+//! @SYMTestExpectedResults  NULL return code
+*/
+TVerdict CMecTest013Step::RunTestStepL()
+    {
+    RMetaExtensionContainerC mec;
+    const Meta::SMetaData* ext = mec.FindExtension(TTestExtension1::TypeId());
+    return ext == NULL ? EPass : EFail;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/datacommsserver/esockserver/test/te_mecunittest/src/mectest014step.cpp	Tue Sep 14 23:38:38 2010 +0300
@@ -0,0 +1,48 @@
+// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+// mectest014step.cpp
+//
+
+/**
+@file
+*/
+
+#include "mectest014step.h"
+#include "testextensions.h"
+#include "metaextensioncontainerspy.h"
+#include <comms-infras/ss_rmetaextensioncontainer.h>
+#include <comms-infras/ss_commsprov.h>
+
+using namespace ESock;
+
+CMecTest014Step::~CMecTest014Step()
+    {
+    }
+
+
+/**
+//! @SYMTestCaseID      MEC_UNIT_TEST_014
+//! @SYMTestCaseDesc    Test KErrNotFound leave for RMetaExtensionContainerC::FindExtensionL() with un-opened container
+//! @SYMFssID           COMMS-INFRAS/Esock/MetaExtensionContainer/UnitTest
+//! @SYMTestActions     1) FindExtensionL T1 in constMec
+//! @SYMTestExpectedResults  Leaves with KErrNotFound
+*/
+TVerdict CMecTest014Step::RunTestStepL()
+    {
+    RMetaExtensionContainerC mec;
+    TRAPD(err, const Meta::SMetaData& ext = mec.FindExtensionL(TTestExtension1::TypeId()));
+    return err == KErrNotFound ? EPass : EFail;
+    }
+
--- a/datacommsserver/esockserver/test/te_mecunittest/src/mecunittestserver.cpp	Wed Sep 01 12:35:48 2010 +0100
+++ b/datacommsserver/esockserver/test/te_mecunittest/src/mecunittestserver.cpp	Tue Sep 14 23:38:38 2010 +0300
@@ -39,6 +39,8 @@
 #include "mectest010step.h"
 #include "mectest011step.h"
 #include "mectest012step.h"
+#include "mectest013step.h"
+#include "mectest014step.h"
 
 #include "mectest030step.h"
 #include "mectest031step.h"
@@ -57,8 +59,6 @@
 #include "mectestpanic2step.h"
 #include "mectestpanic3step.h"
 #include "mectestpanic4step.h"
-#include "mectestpanic5step.h"
-#include "mectestpanic6step.h"
 #include "mectestpanic7step.h"
 #include "mectestpanic8step.h"
 #include "mectestpanic9step.h"
@@ -170,6 +170,8 @@
         TEST_STEP(MecTest010)
 		TEST_STEP(MecTest011)
 		TEST_STEP(MecTest012)
+		TEST_STEP(MecTest013)
+		TEST_STEP(MecTest014)
         
 		TEST_STEP(MecTest030)
 		TEST_STEP(MecTest031)
@@ -186,9 +188,9 @@
 //		TEST_STEP(MecTestPanic1) 
         TEST_STEP(MecTestPanic2) 
         TEST_STEP(MecTestPanic3) 
-        TEST_STEP(MecTestPanic4) 
-        TEST_STEP(MecTestPanic5)
-        TEST_STEP(MecTestPanic6) 
+        TEST_STEP(MecTestPanic4)
+        // MecTestPanic5 and MecTestPanic6 removed as FindExtension()/FindExtensionL()
+        // no longer panic if container hasn't been opened.
 		TEST_STEP(MecTestPanic7) 
 		TEST_STEP(MecTestPanic8) 
 		TEST_STEP(MecTestPanic9)