diff -r 4917f9bf7995 -r 8bfb9186a8b8 browserutilities/connectionmanager/Src/InternetConnectionManager.cpp --- a/browserutilities/connectionmanager/Src/InternetConnectionManager.cpp Tue Apr 27 17:46:17 2010 +0300 +++ b/browserutilities/connectionmanager/Src/InternetConnectionManager.cpp Tue May 11 17:13:44 2010 +0300 @@ -457,18 +457,17 @@ } else { + if(iConnection.SubSessionHandle() <= 0) + { + // RConnection handle is invalid, we haven't opened the RConnection yet. connErr = iConnection.Open( iServ, KAfInet ); + } CLOG_WRITE_1( "RConnection: %d", connErr ); if( connErr == KErrNone ) { // Always pass the IAP Id to RConnection even in silent mode connErr = iSyncConnector->Connect( overrides ); } - if( connErr != KErrNone ) - { - CLOG_WRITE( "Closing all" ); - iConnection.Close(); - } } } if ( iWaitDialog ) @@ -518,11 +517,6 @@ delete iCommsDb; } - if( iConnected ) - { - iConnection.Close(); - } - if( !iSilentMode ) // Temp fix for CDMA { @@ -537,8 +531,8 @@ delete iNoteDialog; delete iSyncConnector; iRFs.Close(); - - iServ.Close(); + iConnection.Close(); + iServ.Close(); CLOG_CLOSE; } @@ -652,11 +646,13 @@ CLOG_ENTERFN( "StopConnectionL()" ); StopConnectionObserving(); + if( iConnected ) { - CLOG_WRITE( "StopConnectionL() Stop the Connection" ); + CLOG_WRITE( "StopConnectionL() Stop the Connection" ); iConnection.Close(); - } + TInt err = iConnection.Open( iServ, KAfInet ); + } // iServ.Close(); iConnected = EFalse; @@ -1379,7 +1375,6 @@ { // this is a connection closed event CLOG_WRITE( "ConnectionStageAchievedL() Stoping the connection instead of closing" ); - iConnection.Close(); iConnected = EFalse; if( !iSilentMode ) @@ -2150,18 +2145,17 @@ if ( !connErr ) { + if(iConnection.SubSessionHandle() <= 0) + { + // RConnection handle is invalid, we haven't opened the RConnection yet. connErr = iConnection.Open( iServ, KAfInet ); + } CLOG_WRITE_1( "RConnection: %d", connErr ); if( connErr == KErrNone ) { //connect with snap id connErr = iSyncConnector->ConnectSnap( overrides ); } - if( connErr != KErrNone ) - { - CLOG_WRITE( "Closing all" ); - iConnection.Close(); - } } CleanupStack::PopAndDestroy();//overrides