diff -r c5b848e6c7d1 -r bbb64eb3bdee bearermanagement/mpm/src/mpmserversession.cpp --- a/bearermanagement/mpm/src/mpmserversession.cpp Thu Jun 10 16:00:16 2010 +0300 +++ b/bearermanagement/mpm/src/mpmserversession.cpp Thu Jun 24 11:36:05 2010 +0300 @@ -69,9 +69,19 @@ : CSession2(), iMyServer( aServer ), iConfirmDlgRoaming( NULL ), + iConnId( 0 ), + iNotifRequested( EFalse ), + iPreferredIAPRequested( EFalse ), + iOfflineFeatureSupported( EFalse ), + iEasyWlanIap( 0 ), + iAppUid( 0 ), iStoredIapInfo(), iIapSelection( NULL ), - iMigrateState( EMigrateNone ) + iMigrateState( EMigrateNone ), + iLastNotifiedIap( 0 ), + iMigrateIap( 0 ), + iUserConnection( 0 ), + iVpnUserConnectionUsed( EFalse ) { } @@ -108,12 +118,19 @@ // iMyServer.RemoveSession( this ); - if (UserConnection()) + if (VpnUserConnectionUsed()) + { + SetVpnUserConnectionUsed( EFalse ); + + MPMLOGSTRING( "CMPMServerSession::~CMPMServerSession -\ + VPN user connection usage ended" ) + } + else if (UserConnection()) { iMyServer.ClearUserConnection(); ClearUserConnection(); - MPMLOGSTRING( "CMPMServerSession::HandleServerApplicationConnectionEnds -\ + MPMLOGSTRING( "CMPMServerSession::~CMPMServerSession -\ User connection deactivated" ) } @@ -429,7 +446,21 @@ MPMLOGSTRING3( "CMPMServerSession::HandleServerChooseIapL - iap %d \ connType %d", mpmConnPref.IapId(), mpmConnPref.ConnType() ) - + + + if ( iMyServer.UseVpnUserConnection(mpmConnPref, + AppUid()) ) + { + // VPN user connection needs to be used. + TBool prepareOk = iMyServer.PrepareVpnUserConnection( mpmConnPref ); + if ( prepareOk ) + { + SetVpnUserConnectionUsed( ETrue ); + MPMLOGSTRING( "CMPMServerSession::HandleServerChooseIapL -\ + VPN user connection used" ) + } + } + iIapSelection->ChooseIapL( mpmConnPref ); if ( iAppUid == iMyServer.CsIdWatcher()->ConnectScreenId() ) @@ -708,7 +739,14 @@ // TConnectionId endId = aMessage.Int0(); - if (UserConnection()) + if (VpnUserConnectionUsed()) + { + SetVpnUserConnectionUsed( EFalse ); + + MPMLOGSTRING( "CMPMServerSession::HandleServerApplicationConnectionEnds -\ + VPN user connection usage ended" ) + } + else if (UserConnection()) { iMyServer.ClearUserConnection(); ClearUserConnection(); @@ -1510,8 +1548,10 @@ case EStarted: // Process error according to the fact that the connection // has already been started. + // KErrConnectionTerminated is received when user disconnects + // connection from Settings/Connection mgr. // - if ( ( error == KErrCancel ) || ( error == KErrTimedOut ) ) + if ( ( error == KErrCancel ) || ( error == KErrTimedOut ) || ( error == KErrConnectionTerminated ) ) { neededAction = EPropagateError; @@ -3425,6 +3465,24 @@ } // ----------------------------------------------------------------------------- +// CMPMServerSession::SetVpnUserConnectionUsed +// ----------------------------------------------------------------------------- +// +void CMPMServerSession::SetVpnUserConnectionUsed( const TBool aUseVpnUserConnection ) + { + if ( aUseVpnUserConnection ) + { + iVpnUserConnectionUsed = ETrue; + iMyServer.AddVpnUserConnectionSession(); + } + else + { + iVpnUserConnectionUsed = EFalse; + iMyServer.RemoveVpnUserConnectionSession(); + } + } + +// ----------------------------------------------------------------------------- // CMPMServerSession::IsWlanOnlyL // ----------------------------------------------------------------------------- //