80 #endif |
80 #endif |
81 } |
81 } |
82 |
82 |
83 // Construction of Backend Object which is going to be singleton object for the process |
83 // Construction of Backend Object which is going to be singleton object for the process |
84 EXPORT_C CLocalSystemInterface::CLocalSystemInterface() : iOpenDirList(CLocalSystemInterface::KDirGran), |
84 EXPORT_C CLocalSystemInterface::CLocalSystemInterface() : iOpenDirList(CLocalSystemInterface::KDirGran), |
85 iTLDInfoList(CLocalSystemInterface::KTLDInfoListGran) |
85 iTLDInfoList(CLocalSystemInterface::KTLDInfoListGran), iDefConnPref(NULL) |
86 { |
86 { |
87 #ifdef SYMBIAN_OE_POSIX_SIGNALS |
87 #ifdef SYMBIAN_OE_POSIX_SIGNALS |
88 iSignalsInitialized = EFalse; |
88 iSignalsInitialized = EFalse; |
89 iSigInitWaitCount = 0; |
89 iSigInitWaitCount = 0; |
90 iSigInitWaitMutex.CreateLocal(); |
90 iSigInitWaitMutex.CreateLocal(); |
182 { |
182 { |
183 User::Panic(KEstlibInit, err); |
183 User::Panic(KEstlibInit, err); |
184 } |
184 } |
185 |
185 |
186 iCleanup.StorePtrs(iPrivateHeap, &iFs, &iSs, &iCs, &iSSLock, &iCSLock); |
186 iCleanup.StorePtrs(iPrivateHeap, &iFs, &iSs, &iCs, &iSSLock, &iCSLock); |
187 |
187 |
188 // No connection settings by default |
|
189 iDefConnPref = NULL; |
|
190 } |
188 } |
191 |
189 |
192 EXPORT_C CLocalSystemInterface::~CLocalSystemInterface() |
190 EXPORT_C CLocalSystemInterface::~CLocalSystemInterface() |
193 // |
191 // |
194 // Shut down all server connections in use |
192 // Shut down all server connections in use |
3769 |
3767 |
3770 return KErrNone; |
3768 return KErrNone; |
3771 } |
3769 } |
3772 |
3770 |
3773 // ----------------------------------------------------------------------------- |
3771 // ----------------------------------------------------------------------------- |
3774 // CLocalSystemInterface::RestartDefConnection |
3772 // CLocalSystemInterface::StartDefConnection |
3775 // |
3773 // |
3776 // Helper function for the setdefaultif() API to restart the |
3774 // Helper function for the setdefaultif() API to restart the |
3777 // default RConnection with the new settings. |
3775 // default RConnection with the new settings. |
3778 // ----------------------------------------------------------------------------- |
3776 // ----------------------------------------------------------------------------- |
3779 // |
3777 // |
3780 TInt CLocalSystemInterface::StartDefConnection() |
3778 TInt CLocalSystemInterface::StartDefConnection() |
3781 { |
3779 { |
3782 //Close the connection and re-open it with the new preferences |
|
3783 if(iDefConnection.SubSessionHandle() != 0) |
|
3784 iDefConnection.Close(); |
|
3785 |
|
3786 TInt err = iDefConnection.Open(iSs); |
3780 TInt err = iDefConnection.Open(iSs); |
3787 if( err != KErrNone ) |
3781 if( err != KErrNone ) |
3788 return err; |
3782 return err; |
3789 |
3783 // If connection preference is set |
3790 err = iDefConnection.Start(*iDefConnPref); |
3784 if (iDefConnPref) |
3791 if( err != KErrNone ) |
3785 { |
|
3786 err = iDefConnection.Start(*iDefConnPref); |
|
3787 } |
|
3788 else // No connection preference available |
|
3789 { |
|
3790 err = iDefConnection.Start(); |
|
3791 } |
|
3792 if (err != KErrNone) |
3792 iDefConnection.Close(); |
3793 iDefConnection.Close(); |
3793 |
|
3794 return err; |
3794 return err; |
3795 } |
3795 } |
3796 |
3796 |
3797 // ----------------------------------------------------------------------------- |
3797 // ----------------------------------------------------------------------------- |
3798 // CLocalSystemInterface::setdefaultif |
3798 // CLocalSystemInterface::setdefaultif |
3805 //If the argument is NULL, close the existing connection |
3805 //If the argument is NULL, close the existing connection |
3806 if(aIfReq == NULL ) |
3806 if(aIfReq == NULL ) |
3807 { |
3807 { |
3808 // Obtain lock on the iDefConnection |
3808 // Obtain lock on the iDefConnection |
3809 iDefConnLock.Wait(); |
3809 iDefConnLock.Wait(); |
3810 if(iDefConnection.SubSessionHandle() != 0) |
3810 |
3811 iDefConnection.Close(); |
3811 if (iDefConnection.SubSessionHandle() != 0) |
|
3812 { |
|
3813 TUint count = iSocketArray.Count(); |
|
3814 for (TInt i = 0; i < count; ++i) |
|
3815 { |
|
3816 iSocketArray[i]->TempClose(); |
|
3817 } |
|
3818 iDefConnection.Close(); |
|
3819 RHeap* oheap = User::SwitchHeap(iPrivateHeap); |
|
3820 iSocketArray.Reset(); |
|
3821 User::SwitchHeap(oheap); |
|
3822 } |
|
3823 |
3812 if( iDefConnPref ) |
3824 if( iDefConnPref ) |
3813 { |
3825 { |
3814 switch( iDefConnPref->ExtensionId() ) |
3826 switch( iDefConnPref->ExtensionId() ) |
3815 { |
3827 { |
3816 case TConnPref::EConnPrefSnap: |
3828 case TConnPref::EConnPrefSnap: |
3939 // ----------------------------------------------------------------------------- |
3951 // ----------------------------------------------------------------------------- |
3940 // |
3952 // |
3941 RConnection& CLocalSystemInterface::GetDefaultConnection() |
3953 RConnection& CLocalSystemInterface::GetDefaultConnection() |
3942 { |
3954 { |
3943 // If GetDefaultConnection is called without calling |
3955 // If GetDefaultConnection is called without calling |
3944 // setdefaultif then the connection is not started |
3956 // setdefaultif then the connection started without any preferences |
3945 // Obtain lock on the iDefConnection |
3957 // Obtain lock on the iDefConnection |
3946 iDefConnLock.Wait(); |
3958 iDefConnLock.Wait(); |
3947 if(iDefConnection.SubSessionHandle() == 0) |
3959 if(iDefConnection.SubSessionHandle() == 0) |
3948 { |
3960 { |
3949 // iDefConnPref should not be NULL for starting the connection |
3961 StartDefConnection(); |
3950 if( iDefConnPref ) |
|
3951 { |
|
3952 StartDefConnection(); |
|
3953 } |
|
3954 } |
3962 } |
3955 // Release lock on the iDefConnection |
3963 // Release lock on the iDefConnection |
3956 iDefConnLock.Signal(); |
3964 iDefConnLock.Signal(); |
3957 return iDefConnection; |
3965 return iDefConnection; |
3958 } |
3966 } |