--- a/genericopenlibs/openenvcore/backend/src/corebackend/localif.cpp Fri Jun 11 15:26:22 2010 +0300
+++ b/genericopenlibs/openenvcore/backend/src/corebackend/localif.cpp Wed Aug 18 11:27:44 2010 +0300
@@ -82,7 +82,7 @@
// Construction of Backend Object which is going to be singleton object for the process
EXPORT_C CLocalSystemInterface::CLocalSystemInterface() : iOpenDirList(CLocalSystemInterface::KDirGran),
-iTLDInfoList(CLocalSystemInterface::KTLDInfoListGran)
+iTLDInfoList(CLocalSystemInterface::KTLDInfoListGran), iDefConnPref(NULL)
{
#ifdef SYMBIAN_OE_POSIX_SIGNALS
iSignalsInitialized = EFalse;
@@ -184,9 +184,7 @@
}
iCleanup.StorePtrs(iPrivateHeap, &iFs, &iSs, &iCs, &iSSLock, &iCSLock);
-
- // No connection settings by default
- iDefConnPref = NULL;
+
}
EXPORT_C CLocalSystemInterface::~CLocalSystemInterface()
@@ -3736,11 +3734,11 @@
TInt err = KErrNone;
//Open the database and create the IAP view.
- CCommsDatabase *iApDb = CCommsDatabase::NewL(EDatabaseTypeIAP);
- CleanupStack::PushL(iApDb);
- iApDb->ShowHiddenRecords();
+ CCommsDatabase *apDb = CCommsDatabase::NewL(EDatabaseTypeIAP);
+ CleanupStack::PushL(apDb);
+ apDb->ShowHiddenRecords();
//The following pushes the view onto the cleanup stack
- CCommsDbTableView *view = iApDb->OpenTableLC(TPtrC(IAP));
+ CCommsDbTableView *view = apDb->OpenTableLC(TPtrC(IAP));
//Iterate through the records to find the matching entry
TAccessPointRecord apRecord;
@@ -3756,7 +3754,7 @@
}
CleanupStack::PopAndDestroy(); //Free the view
- CleanupStack::PopAndDestroy(iApDb); //Free the db itself
+ CleanupStack::PopAndDestroy(apDb); //Free the db itself
if(err != KErrNone) //Record not found
return KErrNotFound;
@@ -3771,7 +3769,7 @@
}
// -----------------------------------------------------------------------------
-// CLocalSystemInterface::RestartDefConnection
+// CLocalSystemInterface::StartDefConnection
//
// Helper function for the setdefaultif() API to restart the
// default RConnection with the new settings.
@@ -3779,18 +3777,20 @@
//
TInt CLocalSystemInterface::StartDefConnection()
{
- //Close the connection and re-open it with the new preferences
- if(iDefConnection.SubSessionHandle() != 0)
- iDefConnection.Close();
-
TInt err = iDefConnection.Open(iSs);
if( err != KErrNone )
return err;
-
- err = iDefConnection.Start(*iDefConnPref);
- if( err != KErrNone )
+ // If connection preference is set
+ if (iDefConnPref)
+ {
+ err = iDefConnection.Start(*iDefConnPref);
+ }
+ else // No connection preference available
+ {
+ err = iDefConnection.Start();
+ }
+ if (err != KErrNone)
iDefConnection.Close();
-
return err;
}
@@ -3807,8 +3807,20 @@
{
// Obtain lock on the iDefConnection
iDefConnLock.Wait();
- if(iDefConnection.SubSessionHandle() != 0)
- iDefConnection.Close();
+
+ if (iDefConnection.SubSessionHandle() != 0)
+ {
+ TUint count = iSocketArray.Count();
+ for (TInt i = 0; i < count; ++i)
+ {
+ iSocketArray[i]->TempClose();
+ }
+ iDefConnection.Close();
+ RHeap* oheap = User::SwitchHeap(iPrivateHeap);
+ iSocketArray.Reset();
+ User::SwitchHeap(oheap);
+ }
+
if( iDefConnPref )
{
switch( iDefConnPref->ExtensionId() )
@@ -3941,16 +3953,12 @@
RConnection& CLocalSystemInterface::GetDefaultConnection()
{
// If GetDefaultConnection is called without calling
- // setdefaultif then the connection is not started
+ // setdefaultif then the connection started without any preferences
// Obtain lock on the iDefConnection
iDefConnLock.Wait();
if(iDefConnection.SubSessionHandle() == 0)
{
- // iDefConnPref should not be NULL for starting the connection
- if( iDefConnPref )
- {
- StartDefConnection();
- }
+ StartDefConnection();
}
// Release lock on the iDefConnection
iDefConnLock.Signal();