connectionmonitoring/connmon/connectionmonitor/src/ConnMonIAP.cpp
changeset 53 4af712113915
parent 20 9c97ad6591ae
--- a/connectionmonitoring/connmon/connectionmonitor/src/ConnMonIAP.cpp	Tue Jul 06 14:42:41 2010 +0300
+++ b/connectionmonitoring/connmon/connectionmonitor/src/ConnMonIAP.cpp	Wed Aug 18 10:10:23 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2002-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"
@@ -421,7 +421,6 @@
 TInt CConnMonIAP::EnumerateConnections( TUint& aCount )
     {
     // Server must be 'blocked' while updating the connection table.
-    TConnectionInfoBuf connInfoBuf;
     TBearerInfo bearerInfo;
     TConnInfo connInfo( 0, 0, 0, 0, bearerInfo );
     TInt err( KErrNone );
@@ -2312,6 +2311,18 @@
             }
 
         iConnInfos.Remove( index );
+
+        // If dial-up PDP context override feature is enabled and active (a dial-up
+        // connection is about to start), connection closures need to be reported
+        // in case dial-up connection is waiting for a free PDP context.
+        if ( iServer->GetDialUpOverrideStatus() == EConnMonDialUpOverrideActive )
+            {
+            if ( !ActivePacketdataConnectionsFound() )
+                {
+                iServer->ConnectionsClosedForDialUpOverride();
+                }
+            }
+
         err = KErrNone;
         }
 
@@ -2979,7 +2990,7 @@
 // CConnMonIAP::GetDeleteNotifyStatus
 // -----------------------------------------------------------------------------------
 //
-TInt CConnMonIAP::GetDeleteNotifyStatus( TConnInfo& aConnection, TBool& aSent )
+TInt CConnMonIAP::GetDeleteNotifyStatus( TConnInfo& aConnection )
     {
     TInt index( KErrNotFound );
 
@@ -2998,29 +3009,6 @@
     aConnection.iConnectionId = iConnInfos[index].iConnectionId;
     aConnection.iBearer = iConnInfos[index].iBearer;
 
-    TInt connectionStatus( 0 );
-    GetConnectionStatus( index, connectionStatus );
-
-    if ( ( iConnInfos[index].iConnDownNotifier != 0 ) &&
-         ( iConnInfos[index].iProgressNotifier != 0 ) )
-        {
-        if ( !iConnInfos[index].iConnDownNotifier->DeleteSent() &&
-             !iConnInfos[index].iConnDownNotifier->IsActive() &&
-             ( !iConnInfos[index].iProgressNotifier->IsActive() ||
-               ( connectionStatus != KLinkLayerOpen ) ) )
-            {
-            aSent = EFalse;
-            }
-        else
-            {
-            aSent = ETrue;
-            }
-        }
-    else
-        {
-        aSent = EFalse;
-        }
-
     return KErrNone;
     }
 
@@ -3353,6 +3341,64 @@
     //LOGEXITFN("CConnMonIAP::GetActiveConnectionsIds()")
     }
 
+// -----------------------------------------------------------------------------
+// CConnMonIAP::ActivePacketdataConnectionsFound
+// Return ETrue if one or more active packetdata connections are found,
+// EFalse otherwise.
+// -----------------------------------------------------------------------------
+//
+TBool CConnMonIAP::ActivePacketdataConnectionsFound()
+    {
+    LOGENTRFN("CConnMonIAP::ActivePacketdataConnectionsFound()")
+    TBool result( EFalse );
+    TInt unknownBearers( 0 );
+
+    const TInt count = iConnInfos.Count();
+    for ( TInt i = 0; i < count; i++ )
+        {
+        // Bearer might still be uninitialized
+        if ( iConnInfos[i].iBearer == EBearerUnknown )
+            {
+            unknownBearers++;
+            }
+        else if ( iConnInfos[i].iBearer == EBearerGPRS ||
+                iConnInfos[i].iBearer == EBearerEdgeGPRS ||
+                iConnInfos[i].iBearer == EBearerWCDMA )
+            {
+            result = ETrue;
+            break;
+            }
+        }
+    if ( !result && unknownBearers )
+        {
+        for ( TInt i = 0; i < count; i++ )
+            {
+            if ( iConnInfos[i].iBearer == EBearerUnknown )
+                {
+                LOGIT1("ActivePacketdataConnectionsFound: bearer unknown for conn.id %d",
+                        iConnInfos[i].iConnectionId)
+                TInt err = GetBearer(
+                        iConnInfos[i].iConnectionId,
+                        iConnInfos[i].iBearer,
+                        iConnInfos[i].iBearerInfo );
+
+                if ( err == KErrNone )
+                    {
+                    if ( iConnInfos[i].iBearer == EBearerGPRS ||
+                            iConnInfos[i].iBearer == EBearerEdgeGPRS ||
+                            iConnInfos[i].iBearer == EBearerWCDMA )
+                        {
+                        result = ETrue;
+                        break;
+                        }
+                    }
+                }
+            }
+        }
+
+    LOGEXITFN1("CConnMonIAP::ActivePacketdataConnectionsFound()", result)
+    return result;
+    }
 
 // -----------------------------------------------------------------------------
 // CConnMonIAP::GetBearerSupportInfo