satengine/SatServer/Commands/OpenChannelCmd/src/COpenChannelHandler.cpp
changeset 15 d7fc66ccd6fb
parent 0 ff3b6d0fd310
--- a/satengine/SatServer/Commands/OpenChannelCmd/src/COpenChannelHandler.cpp	Fri Apr 16 15:31:58 2010 +0300
+++ b/satengine/SatServer/Commands/OpenChannelCmd/src/COpenChannelHandler.cpp	Mon May 03 13:01:45 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"
@@ -65,6 +65,8 @@
     Cancel();
     iDataChannel = NULL;
 
+    delete iConnectionInfo.iOverrideSet;
+
     LOG( SIMPLE,
         "OPENCHANNEL: COpenChannelHandler::~CCloseChannelHandler exiting" )
     }
@@ -633,6 +635,8 @@
         "OPENCHANNEL: COpenChannelHandler::SetConnectionSettingsL calling,\
         aBearerType: %d", aBearerType )
 
+    RPacketContext::TProtocolType pdpType = RPacketContext::EPdpTypeIPv4;
+    TUint32 defaultId( 0 );
     switch ( aBearerType )
         {
         case MSatBIPUtils::ESatGPRS:
@@ -648,9 +652,8 @@
                 TUint32 nwId( 0 );
                 TBool apnCreated( EFalse );
 
-                RPacketContext::TProtocolType pdpType = 
-                           RPacketContext::EPdpTypeIPv6;
-                
+                pdpType = RPacketContext::EPdpTypeIPv6;
+
                 if ( RSat::EIPv4Address ==
                     iOpenChannelData.iDestinationAddress.iType )
                     {
@@ -684,10 +687,14 @@
                 }
             else
                 {
-                LOG( NORMAL, "OPENCHANNEL: COpenChannelHandler::SetConnectionSettingsL \
+                LOG( NORMAL, "OPENCHANNEL: SetConnectionSettingsL \
                 No APN, using defaults" )
                 // No APN, use default settings
-                SetOverrideSettingsL( 0 );
+                TRAPD( err, defaultId = 
+                iUtils->BipUtils().ApnHandler().FindDefaultApL( pdpType ) );
+                LOG2( NORMAL, "OPENCHANNEL: SetConnectionSettingsL \
+                    No APN, using defaults err = %i", err )
+                SetOverrideSettingsL( defaultId );
                 }
             break;
             }
@@ -703,7 +710,11 @@
 
 #ifdef SAT_USE_DUMMY_TSY
     // No APN, use default settings
-    SetOverrideSettingsL( 0 );
+    TRAPD( err, 
+    defaultId = iUtils->BipUtils().ApnHandler().FindDefaultApL( pdpType ) );
+    LOG2( NORMAL, "OPENCHANNEL: COpenChannelHandler::SetConnectionSettingsL \
+        No APN, using defaults err = %i", err )
+    SetOverrideSettingsL( defaultId );
 #endif // SAT_USE_DUMMY_TSY
 
     LOG( SIMPLE,
@@ -721,6 +732,9 @@
     "OPENCHANNEL: COpenChannelHandler::SetOverrideSettingsL aIapId: %i", 
     aIapId )
 
+    delete iConnectionInfo.iOverrideSet;
+    iConnectionInfo.iOverrideSet = NULL;
+
     // Override connection preferences
     TExtendedConnPref* overrideSettings = new( ELeave ) TExtendedConnPref;
     overrideSettings->SetIapId( aIapId );