datacommsserver/esockserver/ssock/ss_sapshim.cpp
branchRCL_3
changeset 26 b564fb5fd78b
parent 25 9d7ce34704c8
child 27 5ebd530e523b
--- a/datacommsserver/esockserver/ssock/ss_sapshim.cpp	Tue Aug 31 16:25:36 2010 +0300
+++ b/datacommsserver/esockserver/ssock/ss_sapshim.cpp	Wed Sep 01 12:35:48 2010 +0100
@@ -268,6 +268,28 @@
 	return this;
     }
 
+void CTransportFlowShim::HostResolverSpecificUnbind()
+	{
+	// Can't have both HR & SAP
+	__ASSERT_DEBUG(!iProvider, User::Panic(KSpecAssert_ESockSSocksspshm, 9));
+
+	if(iSubConnectionProvider.IsOpen())
+		{
+		iSessionControlNotify = NULL;
+		iSessionDataNotify = NULL;
+		iHostResolverNotify = NULL;
+		if (!Idle())
+			{
+			SetIdle();
+			ProcessDCIdleState();
+			}
+		}
+	else
+		{
+		DeleteThisFlow();
+		}
+	}
+
 void CTransportFlowShim::Unbind()
     {
 	LOG( ESockLog::Printf(_L8("CTransportFlowShim %08x:\tUnbind()"), this) );
@@ -279,41 +301,30 @@
 		return;
 		}
 
-	// Legacy support for host resolvers
+	// Legacy support for host resolvers involves a separate north bound MUpperControl interface
 	if(iHostResolverNotify)
 		{
-		__ASSERT_DEBUG(!iProvider, User::Panic(KSpecAssert_ESockSSocksspshm, 9));	// can't have both HR & SAP
-
-		LOG( ESockLog::Printf(_L8("CTransportFlowShim %08x:\tUnbind(): iBearerExpected %d"), this, BearerExpected()) );
-		if (!BearerExpected())
+		HostResolverSpecificUnbind();
+		}
+	else
+		{
+		if (iProvider)
 			{
-			delete this;
-			}
-		else
-			{
-			SetDeleteUponBearerReception();
-			iHostResolverNotify = NULL;
+			iProvider->SetNotify(NULL);
+
+			if (!Detaching())
+				{
+				delete iProvider;
+				iProvider = NULL;
+				}
 			}
-		return;
-		}
-
-	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();
+		}
     }
 
 ESock::CSubConnectionFlowBase& CTransportFlowShim::CloneFlowL()