messagingfw/msgsrvnstore/server/src/MSVSERV.CPP
branchRCL_3
changeset 10 30d6238592e8
parent 0 8e480a14352b
child 11 dd93350a5f29
equal deleted inserted replaced
6:fe71b07a6401 10:30d6238592e8
   249 //CMsvServer
   249 //CMsvServer
   250 //**********************************
   250 //**********************************
   251 
   251 
   252 
   252 
   253 CMsvServer::CMsvServer(TInt aPriority, TBool aDebug)
   253 CMsvServer::CMsvServer(TInt aPriority, TBool aDebug)
   254 :   CPolicyServer(aPriority, msgServerPolicy), iSessionNumber(1), iMtmOperationQueueArray(KMsvMtmOpsQueueArrayGranularity), iDebug(aDebug)
   254 :   CPolicyServer(aPriority, msgServerPolicy), iSessionNumber(1), iMtmOperationQueueArray(KMsvMtmOpsQueueArrayGranularity), iDebug(aDebug), iReleasedForRestore(EFalse)
   255 //
   255 //
   256 //
   256 //
   257 //
   257 //
   258 	{
   258 	{
   259 	}
   259 	}
  2013 #endif
  2013 #endif
  2014 			// The media is not available - use default
  2014 			// The media is not available - use default
  2015 			iStartupState = EMsvMediaUnavailable;
  2015 			iStartupState = EMsvMediaUnavailable;
  2016 			drive = iSystemDrive;
  2016 			drive = iSystemDrive;
  2017 			}
  2017 			}
  2018 		else if (iNewContext->Config().iUniqueID != 0 && iNewContext->Config().iUniqueID != volume.iUniqueID)
       
  2019 			{
       
  2020 #ifndef _NO_SERVER_LOGGING_
       
  2021 			Log(_L("The media is incorrect %d != %d - using default"), iNewContext->Config().iUniqueID, volume.iUniqueID);
       
  2022 #endif
       
  2023 			// The media is incorrect - use default
       
  2024 			iStartupState = EMsvMediaIncorrect;
       
  2025 			drive = iSystemDrive;
       
  2026 			}
       
  2027 		iNewContext->CreateIndexL(drive, aSync);
  2018 		iNewContext->CreateIndexL(drive, aSync);
  2028 		return;
  2019 		return;
  2029 		}
  2020 		}
  2030 	else if (error == KErrInUse)
  2021 	else if (error == KErrInUse)
  2031 		{
  2022 		{
  2275 	{
  2266 	{
  2276 	__ASSERT_DEBUG(iContext->IndexAdapter(), PanicServer(EMsvNoIndex));
  2267 	__ASSERT_DEBUG(iContext->IndexAdapter(), PanicServer(EMsvNoIndex));
  2277 #ifndef _NO_SERVER_LOGGING_
  2268 #ifndef _NO_SERVER_LOGGING_
  2278 	Log(_L("Disk %d removed"), TInt(aDrive));
  2269 	Log(_L("Disk %d removed"), TInt(aDrive));
  2279 #endif
  2270 #endif
  2280 
  2271 	if(iContext->IndexAdapter()->ErrorState() != KMsvIndexRestore)
  2281 	NotifyChanged(EMsvMediaUnavailable, KMsvNullIndexEntryId, TInt(aDrive));
  2272 		{
       
  2273 		NotifyChanged(EMsvMediaUnavailable, KMsvNullIndexEntryId, TInt(aDrive));
       
  2274 		}
       
  2275 	else
       
  2276 		{
       
  2277 		iReleasedForRestore = ETrue;
       
  2278 		}
  2282 	iContext->IndexAdapter()->SetErrorState(KMsvMediaUnavailable);
  2279 	iContext->IndexAdapter()->SetErrorState(KMsvMediaUnavailable);
  2283 	iContext->IndexAdapter()->DeleteDbAdapter();
  2280 	iContext->IndexAdapter()->DeleteDbAdapter();
  2284 
  2281 
  2285 	iStartupState = EMsvMediaUnavailable;
  2282 	iStartupState = EMsvMediaUnavailable;
  2286 	return ETrue;
  2283 	return ETrue;
  2294 	__ASSERT_DEBUG(iContext->IndexAdapter(), PanicServer(EMsvNoIndex));
  2291 	__ASSERT_DEBUG(iContext->IndexAdapter(), PanicServer(EMsvNoIndex));
  2295 
  2292 
  2296 #ifndef _NO_SERVER_LOGGING_
  2293 #ifndef _NO_SERVER_LOGGING_
  2297 	Log(_L("Disk %d inserted"), TInt(aDrive));
  2294 	Log(_L("Disk %d inserted"), TInt(aDrive));
  2298 #endif
  2295 #endif
  2299 
  2296 	if(!iReleasedForRestore)
  2300 	NotifyChanged(EMsvMediaAvailable, KMsvNullIndexEntryId, TInt(aDrive));
  2297 		{
       
  2298 		NotifyChanged(EMsvMediaAvailable, KMsvNullIndexEntryId, TInt(aDrive));
       
  2299 		}
       
  2300 	else
       
  2301 		{
       
  2302 		iReleasedForRestore = EFalse;
       
  2303 		}
  2301 
  2304 
  2302 	iContext->IndexAdapter()->SetErrorState(KErrNone);
  2305 	iContext->IndexAdapter()->SetErrorState(KErrNone);
  2303 
  2306 
  2304 	//Need to re-open the DB when media is available (EMsvMediaAvailable).
  2307 	//Need to re-open the DB when media is available (EMsvMediaAvailable).
  2305 	//Get current drive
  2308 	//Get current drive