bluetooth/gavdp/source/gavdpHelpers.cpp
branchRCL_3
changeset 22 786b94c6f0a4
parent 0 29b1cd4cb562
--- a/bluetooth/gavdp/source/gavdpHelpers.cpp	Thu Jul 15 19:55:36 2010 +0300
+++ b/bluetooth/gavdp/source/gavdpHelpers.cpp	Thu Aug 19 11:01:00 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2004-2010 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"
@@ -473,16 +473,17 @@
 
 	
 
-CGavdpConnector* CGavdpConnector::NewL(CGavdp& aGavdp, MGavdpUser& aUser, const TBTDevAddr& aAddr)
+CGavdpConnector* CGavdpConnector::NewL(CGavdp& aGavdp, MGavdpUser& aUser, const TBTDevAddr& aAddr, TBool aPassive)
 	{
-	return new (ELeave) CGavdpConnector(aGavdp, aUser, aAddr);
+	return new (ELeave) CGavdpConnector(aGavdp, aUser, aAddr, aPassive);
 	}
-	
-CGavdpConnector::CGavdpConnector(CGavdp& aGavdp, MGavdpUser& aUser, const TBTDevAddr& aAddr)
+
+CGavdpConnector::CGavdpConnector(CGavdp& aGavdp, MGavdpUser& aUser, const TBTDevAddr& aAddr, TBool aPassive)
 : CGavdpHelper(aGavdp, aUser)
 	{
 	iSocketAddress.SetBTAddr(aAddr);
 	iSocketAddress.SetSession(ESignalling);
+	iIsPassiveConnector = aPassive;
 	}
 
 CGavdpConnector::~CGavdpConnector()
@@ -492,10 +493,13 @@
 
 void CGavdpConnector::DoCancel()
 	{
-	AvdtpRequester().CancelAll(); // ESOCK has better semantics to SAP than CancelConnect.
+	//don't call cancel on the socket for passive connectors to prevent cancelling a listening socket
+	if (!iIsPassiveConnector)
+		{
+		AvdtpRequester().CancelAll(); // ESOCK has better semantics to SAP than CancelConnect.
+		}
 	}
 
-
 void CGavdpConnector::Begin()
 	{
 	// Ensure that once this is completed the RunL is scheduled
@@ -507,7 +511,6 @@
 
 void CGavdpConnector::RunL()
 	{
-		
 	// Do not call CGavdpHelper::CheckFailedL() here - avdtp will indicate a failure to connect, 
 	// and GAVDP is informed via CGavdpIndicator::RunL().
 	
@@ -751,14 +754,14 @@
 				}
 			};
 		}
+	
+	// This service is never complete, reissue ioctl.  We do this once we have finished using
+	// the iIndication data as once the ioctl has been issued the data may be overwritten.
+	// If AVDTP has an indication to pass to us and an ioctl has not been issued the
+	// indication will be queued within AVDTP until we have issued the ioctl again.
+	Begin();
+	}
 
-		// This service is never complete, reissue ioctl.  We do this once we have finished using
-		// the iIndication data as once the ioctl has been issued the data may be overwritten.
-		// If AVDTP has an indication to pass to us and an ioctl has not been issued the
-		// indication will be queued within AVDTP until we have issued the ioctl again.
-		Begin();
-	}
-	
 /**
 RunError overriden for CGavdpIndicator only. This GAVDP helper is used in its own right by GAVDP.
 It is not treated as a 'general' GAVDP helper, and, unlike a 'general' GAVDP helper,