bluetoothengine/bteng/src/btengsrvpluginmgr.cpp
changeset 26 b78e66e88238
parent 23 988cddd6adbd
child 19 43824b19ee35
--- a/bluetoothengine/bteng/src/btengsrvpluginmgr.cpp	Sat Apr 24 00:12:05 2010 +0300
+++ b/bluetoothengine/bteng/src/btengsrvpluginmgr.cpp	Sat Apr 24 00:30:17 2010 +0300
@@ -485,9 +485,17 @@
     TInt err = KErrNotFound;
     for( TInt i = 0; i < iPluginArray.Count(); i++ )
         {
-            // Should be ignored if the plug-in does not have 
-            // a connection to the address.
-        err = iPluginArray[ i ]->Disconnect( aAddr, aDiscType );
+        // Should be ignored if the plug-in does not have 
+        // a connection to the address.
+        TBTEngConnectionStatus status = iPluginArray[ i ]->IsConnected( aAddr );
+        if( status == EBTEngConnecting || status == EBTEngConnected )
+            {            
+            err = iPluginArray[ i ]->Disconnect( aAddr, aDiscType );
+            if( err )
+                {
+                TRACE_INFO( ( _L( "[BTENG]  ERR! Disconnect failed, plugin index %d with err %d" ), i, err ) )
+                }
+            }
         }
     TRACE_FUNC_RES( ( _L( "result: %d" ), err ) )
     return err;