realtimenetprots/sipfw/ProfileAgent/Server/Src/SipProfileServerCore.cpp
branchRCL_3
changeset 56 2c7192069824
parent 49 0a1ad22c7bdc
equal deleted inserted replaced
49:0a1ad22c7bdc 56:2c7192069824
   394     CSIPProfileCacheItem* item = ProfileCacheItem(aProfile.Id());
   394     CSIPProfileCacheItem* item = ProfileCacheItem(aProfile.Id());
   395     if (!item)
   395     if (!item)
   396     	{
   396     	{
   397     	return EFalse;
   397     	return EFalse;
   398     	}
   398     	}
   399     
   399 
   400       if((aError != KErrNone) && item->HasQueuedUpdate())
       
   401         {
       
   402         PROFILE_DEBUG4("ProfileServerCore::ProceedRegistration HasQueuedUpdate, err",
       
   403 			item->HasQueuedUpdate(), aError)
       
   404         return EFalse;
       
   405         }
       
   406     
       
   407     if ( ShouldChangeIap(item->UsedProfile(), aError) && 
   400     if ( ShouldChangeIap(item->UsedProfile(), aError) && 
   408     	 !item->SnapRetryCountReached() )
   401     	 !item->SnapRetryCountReached() )
   409         {
   402         {
   410         PROFILE_DEBUG1("CSIPProfileServerCore::ProceedRegistration, IAP should be changed")
   403         PROFILE_DEBUG1("CSIPProfileServerCore::ProceedRegistration, IAP should be changed")
   411         // If IAP should be changed, handle this like an error, so the profile
   404         // If IAP should be changed, handle this like an error, so the profile
  1571     {
  1564     {
  1572     TInt index = iObservers.Find(&aObserver);
  1565     TInt index = iObservers.Find(&aObserver);
  1573     if (index != KErrNotFound)
  1566     if (index != KErrNotFound)
  1574         {
  1567         {
  1575         iObservers.Remove(index);
  1568         iObservers.Remove(index);
  1576         iObservers.Compress();
       
  1577         }
  1569         }
  1578 
  1570 
  1579     for (TInt i = 0; i < iProfileCache.Count(); i ++)
  1571     for (TInt i = 0; i < iProfileCache.Count(); i ++)
  1580         {
  1572         {
  1581         CSIPProfileCacheItem* item = iProfileCache[i];
  1573         CSIPProfileCacheItem* item = iProfileCache[i];
  1779 			}
  1771 			}
  1780 		else
  1772 		else
  1781 			{
  1773 			{
  1782 			// Backup ends. Do not read profiles, as they are already in cache.
  1774 			// Backup ends. Do not read profiles, as they are already in cache.
  1783 			iProfileStorage = CSIPProfileStorage::NewL(iFs);
  1775 			iProfileStorage = CSIPProfileStorage::NewL(iFs);
  1784 			iProfileStorage->GetProfileStorageIndexObject()->SetProfileServerCoreObject(this);
       
  1785 			}
  1776 			}
  1786 		PROFILE_DEBUG1("ProfileServerCore::ReserveStorageL, storage reserved")
  1777 		PROFILE_DEBUG1("ProfileServerCore::ReserveStorageL, storage reserved")
  1787 		}
  1778 		}
  1788     }
  1779     }
  1789 
  1780 
  1913 // -----------------------------------------------------------------------------
  1904 // -----------------------------------------------------------------------------
  1914 // CSIPProfileServerCore::MigrationControllerL
  1905 // CSIPProfileServerCore::MigrationControllerL
  1915 // -----------------------------------------------------------------------------
  1906 // -----------------------------------------------------------------------------
  1916 //
  1907 //
  1917 CSipAlrMigrationController&
  1908 CSipAlrMigrationController&
  1918 CSIPProfileServerCore::MigrationControllerL(TSipSNAPConfigurationData aSnapData)
  1909 CSIPProfileServerCore::MigrationControllerL(TUint32 aSnapId)
  1919 	{
  1910 	{
  1920 	RemoveUnusedMigrationControllers(aSnapData.iSnapId);
  1911 	RemoveUnusedMigrationControllers(aSnapId);
  1921 
  1912 
  1922 	for (TInt i = 0; i < iMigrationControllers.Count(); ++i)
  1913 	for (TInt i = 0; i < iMigrationControllers.Count(); ++i)
  1923 		{
  1914 		{
  1924         // Migration controller is unique based on the SNAP ID and Bearer ID.
  1915 		if (iMigrationControllers[i]->SnapId() == aSnapId)
  1925 		if (iMigrationControllers[i]->SnapId() == aSnapData.iSnapId 
       
  1926 		        && iMigrationControllers[i]->BearerId() == aSnapData.iBearerId)
       
  1927 			{
  1916 			{
  1928 			return *iMigrationControllers[i];
  1917 			return *iMigrationControllers[i];
  1929 			}
  1918 			}
  1930 		}
  1919 		}
  1931 
  1920 
  1932 	CSipAlrMigrationController* ctrl =
  1921 	CSipAlrMigrationController* ctrl =
  1933 		CSipAlrMigrationController::NewLC(iAlrHandler->AlrMonitorL(),aSnapData);
  1922 		CSipAlrMigrationController::NewLC(iAlrHandler->AlrMonitorL(), aSnapId);
  1934 	iMigrationControllers.AppendL(ctrl);
  1923 	iMigrationControllers.AppendL(ctrl);
  1935 	CleanupStack::Pop(ctrl);
  1924 	CleanupStack::Pop(ctrl);
  1936 	return *ctrl;
  1925 	return *ctrl;
  1937 	}
  1926 	}
  1938 
  1927 
  1953 	{
  1942 	{
  1954     TInt index = ProfileCached(aProfileId);
  1943     TInt index = ProfileCached(aProfileId);
  1955     if (index >= 0)
  1944     if (index >= 0)
  1956     	{
  1945     	{
  1957     	iProfileCache.Remove(index);
  1946     	iProfileCache.Remove(index);
  1958     	iProfileCache.Compress();
       
  1959     	}
  1947     	}
  1960 	}
  1948 	}
  1961 
  1949 
  1962 // -----------------------------------------------------------------------------
  1950 // -----------------------------------------------------------------------------
  1963 // CSIPProfileServerCore::RemoveUnusedMigrationControllers
  1951 // CSIPProfileServerCore::RemoveUnusedMigrationControllers
  1970 		if (!iMigrationControllers[i]->IsUsed() &&
  1958 		if (!iMigrationControllers[i]->IsUsed() &&
  1971 			iMigrationControllers[i]->SnapId() != aSnapId)
  1959 			iMigrationControllers[i]->SnapId() != aSnapId)
  1972 			{
  1960 			{
  1973 			CSipAlrMigrationController* unused = iMigrationControllers[i];
  1961 			CSipAlrMigrationController* unused = iMigrationControllers[i];
  1974 			iMigrationControllers.Remove(i);
  1962 			iMigrationControllers.Remove(i);
  1975 			iMigrationControllers.Compress();
       
  1976 			delete unused;
  1963 			delete unused;
  1977 			unused = NULL;
       
  1978 			}
  1964 			}
  1979 		}
  1965 		}
  1980 	}
  1966 	}
  1981 
  1967 
  1982 // -----------------------------------------------------------------------------
  1968 // -----------------------------------------------------------------------------