browserutilities/connectionmanager/Src/InternetConnectionManager.cpp
branchRCL_3
changeset 40 8bfb9186a8b8
parent 37 ac77f89b1d9e
child 41 4bd5176e1bc8
equal deleted inserted replaced
38:4917f9bf7995 40:8bfb9186a8b8
   455 			{
   455 			{
   456 			connErr = KErrCancel;
   456 			connErr = KErrCancel;
   457 			}
   457 			}
   458 		else
   458 		else
   459 			{               
   459 			{               
       
   460             if(iConnection.SubSessionHandle() <= 0)
       
   461                 {
       
   462 				//  RConnection handle is invalid, we haven't opened the RConnection yet.
   460 		        connErr = iConnection.Open( iServ, KAfInet );
   463 		        connErr = iConnection.Open( iServ, KAfInet );
       
   464 		       	}
   461 		        CLOG_WRITE_1( "RConnection: %d", connErr );
   465 		        CLOG_WRITE_1( "RConnection: %d", connErr );
   462 		        if( connErr == KErrNone )
   466 		        if( connErr == KErrNone )
   463 		            {
   467 		            {
   464 		            // Always pass the IAP Id to RConnection even in silent mode
   468 		            // Always pass the IAP Id to RConnection even in silent mode
   465 		            connErr = iSyncConnector->Connect( overrides );
   469 		            connErr = iSyncConnector->Connect( overrides );
   466 		            }
       
   467 		        if( connErr != KErrNone )
       
   468 		            {
       
   469 		            CLOG_WRITE( "Closing all" );
       
   470 		            iConnection.Close();
       
   471 		            }
   470 		            }
   472 			}
   471 			}
   473 		}
   472 		}
   474 	if ( iWaitDialog )
   473 	if ( iWaitDialog )
   475 		{
   474 		{
   516 	if ( iCommsDbOwned )
   515 	if ( iCommsDbOwned )
   517 		{
   516 		{
   518 		delete iCommsDb;
   517 		delete iCommsDb;
   519 		}
   518 		}
   520 
   519 
   521     if( iConnected )
       
   522         {
       
   523         iConnection.Close();
       
   524         }
       
   525 
       
   526     if( !iSilentMode )
   520     if( !iSilentMode )
   527         // Temp fix for CDMA
   521         // Temp fix for CDMA
   528         {
   522         {
   529         delete iCurrentAP;
   523         delete iCurrentAP;
   530         }
   524         }
   535     delete iConnName;
   529     delete iConnName;
   536 	delete iWaitDialog;
   530 	delete iWaitDialog;
   537 	delete iNoteDialog;
   531 	delete iNoteDialog;
   538 	delete iSyncConnector;
   532 	delete iSyncConnector;
   539 	iRFs.Close();
   533 	iRFs.Close();
   540 
   534 	iConnection.Close();
   541     iServ.Close();
   535 	iServ.Close();
   542     
   536     
   543 	CLOG_CLOSE;
   537 	CLOG_CLOSE;
   544 	}
   538 	}
   545 	
   539 	
   546 //--------------------------------------------------------------------------
   540 //--------------------------------------------------------------------------
   650 EXPORT_C void CInternetConnectionManager::StopConnectionL()
   644 EXPORT_C void CInternetConnectionManager::StopConnectionL()
   651 	{
   645 	{
   652     CLOG_ENTERFN( "StopConnectionL()" );
   646     CLOG_ENTERFN( "StopConnectionL()" );
   653 
   647 
   654     StopConnectionObserving();
   648     StopConnectionObserving();
       
   649     
   655     if( iConnected )
   650     if( iConnected )
   656         {
   651         {
   657         CLOG_WRITE( "StopConnectionL() Stop the Connection" );
   652         CLOG_WRITE( "StopConnectionL() Stop the Connection" );        
   658         iConnection.Close();
   653         iConnection.Close();
   659         }
   654         TInt err = iConnection.Open( iServ, KAfInet );        
       
   655         }    
   660     
   656     
   661 //    iServ.Close();
   657 //    iServ.Close();
   662     iConnected = EFalse;
   658     iConnected = EFalse;
   663     iEasyWlan = EFalse;
   659     iEasyWlan = EFalse;
   664 
   660 
  1377  //   CLOG_WRITE_1( "ConnectionStageAchievedL() Stage = %d ", aStage);
  1373  //   CLOG_WRITE_1( "ConnectionStageAchievedL() Stage = %d ", aStage);
  1378      if(iConnected) 
  1374      if(iConnected) 
  1379      {
  1375      {
  1380      	// this is a connection closed event
  1376      	// this is a connection closed event
  1381         CLOG_WRITE( "ConnectionStageAchievedL() Stoping the connection instead of closing" );
  1377         CLOG_WRITE( "ConnectionStageAchievedL() Stoping the connection instead of closing" );
  1382         iConnection.Close();
       
  1383     	iConnected = EFalse;
  1378     	iConnected = EFalse;
  1384 
  1379 
  1385     	if( !iSilentMode )
  1380     	if( !iSilentMode )
  1386         // Temp fix for CDMA
  1381         // Temp fix for CDMA
  1387         {
  1382         {
  2148 
  2143 
  2149 	CLOG_WRITE( "ConnMan Overrides set"  );
  2144 	CLOG_WRITE( "ConnMan Overrides set"  );
  2150 
  2145 
  2151 	if ( !connErr )
  2146 	if ( !connErr )
  2152 		{
  2147 		{
       
  2148 		if(iConnection.SubSessionHandle() <= 0)
       
  2149 			{
       
  2150 			//  RConnection handle is invalid, we haven't opened the RConnection yet.
  2153         connErr = iConnection.Open( iServ, KAfInet );
  2151         connErr = iConnection.Open( iServ, KAfInet );
       
  2152         	}
  2154         CLOG_WRITE_1( "RConnection: %d", connErr );
  2153         CLOG_WRITE_1( "RConnection: %d", connErr );
  2155         if( connErr == KErrNone )
  2154         if( connErr == KErrNone )
  2156             {
  2155             {
  2157            //connect with snap id
  2156            //connect with snap id
  2158             connErr = iSyncConnector->ConnectSnap( overrides );
  2157             connErr = iSyncConnector->ConnectSnap( overrides );
  2159             }
       
  2160         if( connErr != KErrNone )
       
  2161             {
       
  2162             CLOG_WRITE( "Closing all" );
       
  2163             iConnection.Close();
       
  2164             }
  2158             }
  2165 		}
  2159 		}
  2166 	
  2160 	
  2167 	CleanupStack::PopAndDestroy();//overrides
  2161 	CleanupStack::PopAndDestroy();//overrides
  2168     iInternalError = connErr;
  2162     iInternalError = connErr;