sl@0: // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: #include sl@0: #include "Baksrvs.h" sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include "patchdata.h" sl@0: sl@0: extern const BSUL::TClientMessageServerData KServerData; sl@0: sl@0: const TInt KBakServMaxOperationTimerLoops = 3; // Number of iterations for base operation timer sl@0: sl@0: _LIT(KPanic,"BackupServer"); sl@0: // sl@0: // RMessage::Panic() also completes the message. This is: sl@0: // (a) important for efficient cleanup within the kernel sl@0: // (b) a problem if the message is completed a second time sl@0: // sl@0: void PanicClient(const RMessagePtr2& aMessage, TInt aPanic) sl@0: { sl@0: aMessage.Panic(KPanic,aPanic); sl@0: } sl@0: sl@0: sl@0: // sl@0: // class CShutdownServer sl@0: // sl@0: sl@0: NONSHARABLE_CLASS(CShutdownServer) : public CTimer sl@0: { sl@0: enum {KMyShutdownDelay=0x2000000}; // approx 2s sl@0: public: sl@0: inline CShutdownServer(); sl@0: inline void ConstructL(); sl@0: inline void Start(); sl@0: private: sl@0: void RunL(); sl@0: }; sl@0: sl@0: inline CShutdownServer::CShutdownServer() sl@0: :CTimer(-1) sl@0: { sl@0: CActiveScheduler::Add(this); sl@0: } sl@0: sl@0: inline void CShutdownServer::ConstructL() sl@0: { sl@0: CTimer::ConstructL(); sl@0: } sl@0: inline void CShutdownServer::Start() sl@0: { sl@0: After(KMyShutdownDelay); sl@0: } sl@0: sl@0: // sl@0: // Initiate server exit when the timer expires sl@0: // sl@0: void CShutdownServer::RunL() sl@0: { sl@0: CActiveScheduler::Stop(); sl@0: } sl@0: sl@0: sl@0: // sl@0: // class CBaServBackupScheduler sl@0: // sl@0: sl@0: EXPORT_C CBaServBackupScheduler::CBaServBackupScheduler() sl@0: { sl@0: } sl@0: sl@0: EXPORT_C CBaServBackupScheduler::~CBaServBackupScheduler() sl@0: { sl@0: } sl@0: sl@0: /** sl@0: * sl@0: * Set the error handler to aErrorHandler to the current scheduler. sl@0: * sl@0: * @param "CBaServBackupSession* aErrorHandler" sl@0: * The handler session. sl@0: */ sl@0: EXPORT_C void CBaServBackupScheduler::SetErrorHandler(CBaServBackupSession* aErrorHandler) sl@0: { sl@0: iErrorHandler=aErrorHandler; sl@0: } sl@0: sl@0: /** sl@0: * sl@0: * Handles the error aError. sl@0: * sl@0: * @param "TInt aError" sl@0: * The error. sl@0: */ sl@0: EXPORT_C void CBaServBackupScheduler::Error(TInt aError) const sl@0: { sl@0: if (iErrorHandler) sl@0: { sl@0: iErrorHandler->HandleError(aError); sl@0: } sl@0: else if (aError!=KLeaveWithoutAlert) sl@0: { sl@0: // Handling the in this way implies that ServiceL should not leave. sl@0: CActiveScheduler::Error(aError); sl@0: } sl@0: } sl@0: sl@0: /** sl@0: Class CBaServBackupSession::CReRegistrationTimer sl@0: */ sl@0: NONSHARABLE_CLASS(CBaServBackupSession::CReRegistrationTimer) : public CPeriodic sl@0: { sl@0: public: sl@0: static CReRegistrationTimer* NewL(TInt aPriority); sl@0: static TInt ReRegistrationTimerCallBack(TAny* aPtr); sl@0: sl@0: protected: sl@0: TInt RunError(TInt aError); sl@0: sl@0: private: sl@0: CReRegistrationTimer(TInt aPriority); sl@0: void HandleReRegistrationTimerCallBack(); sl@0: sl@0: public: sl@0: CBaBackupServer* iBackupServer; sl@0: }; sl@0: sl@0: /** sl@0: Class CBaBackupServer::CBaServCloseAllOperationTimer sl@0: */ sl@0: sl@0: NONSHARABLE_CLASS(CBaBackupServer::CBaServCloseAllOperationTimer): public CPeriodic sl@0: { sl@0: public: sl@0: static CBaServCloseAllOperationTimer* NewL(CBaBackupServer* aBackupServer); sl@0: void ConstructL(CBaBackupServer* aBackupServer); sl@0: ~CBaServCloseAllOperationTimer(); sl@0: void SetMessage(const RMessagePtr2& aPtr); sl@0: RMessagePtr2 Message(); sl@0: TInt GetOperationCount(); sl@0: void SetOperationCount(TInt aCount); sl@0: static TInt OperationTimerCallBack(TAny* aPtr); sl@0: protected: sl@0: TInt RunError(TInt aError); sl@0: private: sl@0: void HandleOperationTimerCallBack(); sl@0: CBaServCloseAllOperationTimer(); sl@0: private: sl@0: RMessagePtr2 iCloseAllFilesMessage; sl@0: TInt16 iOperationCount; sl@0: CBaBackupServer* iBackupServer; sl@0: }; sl@0: sl@0: // sl@0: // class CBaBackupServer sl@0: // sl@0: sl@0: /** sl@0: * sl@0: * Returns a pointer to CBaBackupServer object. sl@0: * sl@0: * @return "CBaBackupServer" sl@0: * A newly-constructed backup server object. sl@0: */ sl@0: EXPORT_C CBaBackupServer* CBaBackupServer::NewL() sl@0: { // static sl@0: CBaBackupServer* self=new(ELeave) CBaBackupServer(CActive::EPriorityStandard); sl@0: return self; sl@0: } sl@0: sl@0: /** sl@0: * sl@0: * Constructor. sl@0: * sl@0: * @param "TInt aPriority" sl@0: * The active object priority. sl@0: */ sl@0: EXPORT_C CBaBackupServer::CBaBackupServer(TInt aPriority) sl@0: : CServer2(aPriority) sl@0: {} sl@0: /** sl@0: * sl@0: * Destructor. sl@0: * sl@0: */ sl@0: EXPORT_C CBaBackupServer::~CBaBackupServer() sl@0: { sl@0: TDblQueIter iter(iSessionIter); sl@0: iter.SetToFirst(); sl@0: sl@0: for (CSession2* session=iter++; session!=NULL; session=iter++) sl@0: { sl@0: delete session; sl@0: } sl@0: delete iShutdown; sl@0: delete iExtension; sl@0: delete iCloseAllFilesOperationTimer; sl@0: } sl@0: sl@0: /** sl@0: * sl@0: * Completes the server construction by adding the server to the active scheduler and creating sl@0: * a CShutdownServer object. sl@0: * sl@0: */ sl@0: EXPORT_C void CBaBackupServer::ConstructL() sl@0: { sl@0: StartL(__BACKUP_SERVER_NAME_V2); sl@0: iExtension = new(ELeave) CBaBackupServerExt(); sl@0: iShutdown = new (ELeave) CShutdownServer; sl@0: iShutdown->ConstructL(); sl@0: // ensure that the server still exits even if the 1st client fails to connect sl@0: iShutdown->Start(); sl@0: iRegisteredFilesCount = 0; sl@0: iCloseAllFilesOperationTimer = CBaBackupServer::CBaServCloseAllOperationTimer::NewL(this); sl@0: iCloseAllOperationRunning = EFalse; sl@0: sl@0: //initialise the client message framework sl@0: BSUL::CClientMessage::InitialiseFrameworkL(KServerData); sl@0: } sl@0: sl@0: /** sl@0: * sl@0: * Sets the server to be busy with the aUniqueClientId client. sl@0: * sl@0: * @param "TUint32 aUniqueClientId" sl@0: * A unique client identifier. sl@0: */ sl@0: EXPORT_C void CBaBackupServer::SetBusy(TUint32 aUniqueClientId) sl@0: { sl@0: iExtension->iUniqueBusyClientId=aUniqueClientId; sl@0: } sl@0: sl@0: /** sl@0: * sl@0: * Returns ETrue if the client using the server is not the one identified by aUniqueClientId sl@0: * oterwise EFalse sl@0: * sl@0: * @param "TUint32 aUniqueClientId" sl@0: * A unique client identifier. sl@0: */ sl@0: EXPORT_C TBool CBaBackupServer::IsOtherClientBusy(TUint32 aUniqueClientId) const sl@0: { sl@0: return (iExtension->iUniqueBusyClientId!=0 && iExtension->iUniqueBusyClientId!=aUniqueClientId); sl@0: } sl@0: sl@0: /** sl@0: * sl@0: * Returns ETrue if the client using the server corresponds has aUniqueClientId as unique id sl@0: * oterwise EFalse sl@0: * sl@0: * @param "TUint32 aUniqueClientId" sl@0: * A unique client identifier id. sl@0: */ sl@0: EXPORT_C TBool CBaBackupServer::IsClientBusy(TUint32 aUniqueClientId) const sl@0: { sl@0: return ((iExtension->iUniqueBusyClientId==aUniqueClientId) || sl@0: ((iExtension->iCachedBusyClientId != 0) && (iExtension->iCachedBusyClientId == aUniqueClientId))); sl@0: } sl@0: sl@0: /** sl@0: * sl@0: * Handles the closing of all files by signaling the new file lock flag, aFlag, to all client. sl@0: * sl@0: * @param "MBackupObserver::TFileLockFlags aFlag" sl@0: * A file lock flag. sl@0: */ sl@0: EXPORT_C void CBaBackupServer::CloseAllFilesL(MBackupObserver::TFileLockFlags aFlag) sl@0: { sl@0: // Set the close all operation flag and the reregistration counter to zero sl@0: iCloseAllOperationRunning = ETrue; sl@0: iSessionLockReRegistrationCount = 0; sl@0: sl@0: // cleanup that calls RestartAll if required sl@0: TDblQueIter iter(iSessionIter); sl@0: iter.SetToFirst(); sl@0: sl@0: for (CSession2* session=iter++; session!=NULL; session=iter++) sl@0: { sl@0: static_cast(session)->SignalReleaseAllFileLocksL(aFlag); sl@0: } sl@0: } sl@0: sl@0: /** sl@0: * sl@0: * Signals to all clients of getting the lock of their respective files. sl@0: * sl@0: */ sl@0: EXPORT_C void CBaBackupServer::RestartAll() sl@0: { sl@0: TDblQueIter iter(iSessionIter); sl@0: iter.SetToFirst(); sl@0: sl@0: for (CSession2* session=iter++; session!=NULL; session=iter++) sl@0: { sl@0: static_cast(session)->SignalRetakeAllFileLocks(); sl@0: } sl@0: } sl@0: sl@0: /** sl@0: * sl@0: * Allows any subclass of CBaBackupServer of completing the closing of files. sl@0: * The server will lose the ownership of aClosedFiles object, which implies it is up to this virtual sl@0: * function to deal with it in order to avoid a memory leak. sl@0: * sl@0: * @param "CArrayFix* aClosedFiles" sl@0: * An array of closed files. sl@0: */ sl@0: EXPORT_C void CBaBackupServer::CompleteClosingFiles(CArrayFix* aClosedFiles) sl@0: { sl@0: delete aClosedFiles; sl@0: } sl@0: sl@0: /** sl@0: * sl@0: * Allows application framework backup code to check if all registerd files have beem updated sl@0: * sl@0: */ sl@0: EXPORT_C TBool CBaBackupServer::HaveAllCloseAllFilesClientsReRegistered() sl@0: { sl@0: return((iRegisteredFilesCount == iSessionLockReRegistrationCount) ? ETrue : EFalse); sl@0: } sl@0: sl@0: void CBaBackupServer::CloseFileL(MBackupObserver::TFileLockFlags aFlag,const TDesC& aFileName) sl@0: { sl@0: TDblQueIter iter(iSessionIter); sl@0: iter.SetToFirst(); sl@0: sl@0: for (CSession2* session=iter++; session!=NULL; session=iter++) sl@0: { sl@0: static_cast(session)->SignalReleaseFileLockL(aFlag,aFileName); sl@0: } sl@0: } sl@0: sl@0: void CBaBackupServer::RestartFile(const TDesC& aFileName) sl@0: { sl@0: TDblQueIter iter(iSessionIter); sl@0: iter.SetToFirst(); sl@0: sl@0: for (CSession2* session=iter++; session!=NULL; session=iter++) sl@0: { sl@0: static_cast(session)->SignalRetakeFileLocks(aFileName); sl@0: } sl@0: } sl@0: sl@0: /** sl@0: * sl@0: * Creates a server-side client CBaServBackupSession session object by checking first if sl@0: * the version of the server is compatible with the client. sl@0: * sl@0: * @param "const TVersion &aVersion" sl@0: * Version information supplied by the client. sl@0: */ sl@0: EXPORT_C CSession2* CBaBackupServer::NewSessionL(const TVersion &aVersion, const RMessage2& /*aMessage*/) const sl@0: { sl@0: TVersion ver(KBakServMajorVN,KBakServMinorVN,KBakServBuildVN); sl@0: if (!User::QueryVersionSupported(ver,aVersion)) sl@0: User::Leave(KErrNotSupported); sl@0: // sl@0: return CBaServBackupSession::NewL(); sl@0: } sl@0: sl@0: /** sl@0: * sl@0: * Signals to all clients the aBackupOperationAttributes. sl@0: * sl@0: * @param "const TBackupOperationAttributes& aBackupOperationAttributes" sl@0: * Backup operation attributes. sl@0: */ sl@0: EXPORT_C void CBaBackupServer::SignalBackupOperation(const TBackupOperationAttributes& aBackupOperationAttributes) sl@0: { sl@0: TDblQueIter iter(iSessionIter); sl@0: iter.SetToFirst(); sl@0: sl@0: for (CSession2* session=iter++; session!=NULL; session=iter++) sl@0: { sl@0: static_cast(session)->SignalBackupOperation(aBackupOperationAttributes); sl@0: } sl@0: // Cache session id if starting backup sl@0: if (aBackupOperationAttributes.iOperation == MBackupOperationObserver::EStart) sl@0: iExtension->iCachedBusyClientId = iExtension->iUniqueBusyClientId; sl@0: } sl@0: sl@0: void CBaBackupServer::AddSession() sl@0: { sl@0: iShutdown->Cancel(); sl@0: ++iSessionCount; sl@0: } sl@0: sl@0: void CBaBackupServer::DropSession() sl@0: { sl@0: if (--iSessionCount==0) sl@0: { sl@0: iShutdown->Start(); sl@0: } sl@0: } sl@0: sl@0: /* sl@0: * Check to see if a CloseAll opertation is in progress sl@0: * sl@0: */ sl@0: TBool CBaBackupServer::IsCloseAllOperationRunning() sl@0: { sl@0: return iCloseAllOperationRunning; sl@0: } sl@0: sl@0: /* sl@0: * Set value of IsCloseAllOperationRunning sl@0: * sl@0: */ sl@0: EXPORT_C void CBaBackupServer::SetCloseAllOperationRunningState(TBool aRunning) sl@0: { sl@0: iCloseAllOperationRunning = aRunning; sl@0: } sl@0: sl@0: /** sl@0: * sl@0: * This timer will only be created in cases of no derived backup server sl@0: * sl@0: */ sl@0: void CBaBackupServer::StartCloseAllFilesOperationTimer(const RMessagePtr2& aPtr) sl@0: { sl@0: // Store the CloseAll message in case we need to Complete on a timeout sl@0: iCloseAllFilesOperationTimer->SetMessage(aPtr); sl@0: sl@0: // If hardware use patchable constant if not default to 3 seconds sl@0: iCloseAllFilesOperationTimer->Start(KBaBackupCloseallFilesTimeout, KBaBackupCloseallFilesTimeout, TCallBack(CBaBackupServer::CBaServCloseAllOperationTimer::OperationTimerCallBack, iCloseAllFilesOperationTimer)); sl@0: } sl@0: sl@0: /** sl@0: * Handle an error from CBaServBackupSession::ServiceL() sl@0: * A bad descriptor error implies a badly programmed client, so panic it; sl@0: * otherwise report the error to the client sl@0: * sl@0: * @param "TInt aError" sl@0: * The error. sl@0: */ sl@0: EXPORT_C TInt CBaBackupServer::RunError(TInt aError) sl@0: { sl@0: if (aError==KErrBadDescriptor) sl@0: { sl@0: PanicClient(Message(), EBufferOverflow); sl@0: } sl@0: else sl@0: { sl@0: Message().Complete(aError); sl@0: } sl@0: // sl@0: // The leave will result in an early return from CServer::RunL(), skipping sl@0: // the call to request another message. So do that now in order to keep the sl@0: // server running. sl@0: ReStart(); sl@0: return KErrNone; // handled the error fully sl@0: } sl@0: sl@0: // sl@0: // class CBaBackupServer::CBaServCloseAllOperationTimer sl@0: // sl@0: sl@0: /** sl@0: @internalComponent sl@0: */ sl@0: CBaBackupServer::CBaServCloseAllOperationTimer* CBaBackupServer::CBaServCloseAllOperationTimer::NewL(CBaBackupServer* aBackupServer) sl@0: { // static sl@0: CBaBackupServer::CBaServCloseAllOperationTimer* self=new(ELeave) CBaBackupServer::CBaServCloseAllOperationTimer(); sl@0: CleanupStack::PushL(self); sl@0: self->ConstructL(aBackupServer); sl@0: CleanupStack::Pop(); // self sl@0: CActiveScheduler::Add(self); sl@0: return self; sl@0: } sl@0: sl@0: /** sl@0: @internalComponent sl@0: */ sl@0: sl@0: void CBaBackupServer::CBaServCloseAllOperationTimer::ConstructL(CBaBackupServer* aBackupServer) sl@0: { sl@0: CTimer::ConstructL(); sl@0: iBackupServer = aBackupServer; sl@0: iOperationCount = 0; sl@0: } sl@0: /** sl@0: @internalComponent sl@0: */ sl@0: sl@0: TInt CBaBackupServer::CBaServCloseAllOperationTimer::GetOperationCount() sl@0: { sl@0: return iOperationCount; sl@0: } sl@0: sl@0: /** sl@0: @internalComponent sl@0: */ sl@0: sl@0: void CBaBackupServer::CBaServCloseAllOperationTimer::SetOperationCount(TInt aCount) sl@0: { sl@0: iOperationCount = aCount; sl@0: } sl@0: sl@0: /** sl@0: @internalComponent sl@0: */ sl@0: sl@0: TInt CBaBackupServer::CBaServCloseAllOperationTimer::RunError(TInt aError) sl@0: { sl@0: if (aError==KLeaveWithoutAlert) sl@0: { sl@0: return KErrNone; sl@0: } sl@0: return aError; sl@0: } sl@0: sl@0: /** sl@0: @internalComponent sl@0: */ sl@0: CBaBackupServer::CBaServCloseAllOperationTimer::CBaServCloseAllOperationTimer() sl@0: : CPeriodic(CActive::EPriorityStandard) sl@0: { ; } sl@0: sl@0: /** sl@0: @internalComponent sl@0: */ sl@0: CBaBackupServer::CBaServCloseAllOperationTimer::~CBaServCloseAllOperationTimer() sl@0: { sl@0: if (IsActive()) sl@0: Cancel(); sl@0: } sl@0: sl@0: /** sl@0: @internalComponent sl@0: */ sl@0: void CBaBackupServer::CBaServCloseAllOperationTimer::SetMessage(const RMessagePtr2& aPtr) sl@0: { sl@0: iCloseAllFilesMessage = aPtr; sl@0: } sl@0: sl@0: /** sl@0: @internalComponent sl@0: */ sl@0: RMessagePtr2 CBaBackupServer::CBaServCloseAllOperationTimer::Message() sl@0: { sl@0: return iCloseAllFilesMessage; sl@0: } sl@0: sl@0: /** sl@0: @internalComponent sl@0: */ sl@0: TInt CBaBackupServer::CBaServCloseAllOperationTimer::OperationTimerCallBack(TAny* aPtr) sl@0: { // static sl@0: TRAP_IGNORE(REINTERPRET_CAST(CBaBackupServer::CBaServCloseAllOperationTimer*,aPtr)->HandleOperationTimerCallBack()); sl@0: return 0; sl@0: } sl@0: sl@0: /** sl@0: @internalComponent sl@0: */ sl@0: void CBaBackupServer::CBaServCloseAllOperationTimer::HandleOperationTimerCallBack() sl@0: { sl@0: TBool finished = iBackupServer->HaveAllCloseAllFilesClientsReRegistered(); sl@0: TInt retCode; sl@0: if (finished || (iOperationCount == KBakServMaxOperationTimerLoops)) sl@0: { sl@0: if (finished) sl@0: { sl@0: retCode = KErrNone; sl@0: } sl@0: else sl@0: { sl@0: retCode = KErrLocked; sl@0: } sl@0: sl@0: // One way or another CloseAll is finished at this point sl@0: iBackupServer->SetCloseAllOperationRunningState(EFalse); sl@0: sl@0: iCloseAllFilesMessage.Complete(retCode); sl@0: Cancel(); sl@0: } sl@0: else sl@0: { sl@0: iOperationCount++; sl@0: if (IsActive()) sl@0: { sl@0: Cancel(); sl@0: sl@0: // If hardware use patchable constant if not default to 3 seconds sl@0: Start(KBaBackupCloseallFilesTimeout, KBaBackupCloseallFilesTimeout, TCallBack(CBaBackupServer::CBaServCloseAllOperationTimer::OperationTimerCallBack,this)); sl@0: } sl@0: } sl@0: } sl@0: sl@0: // sl@0: // class CBaServBackupMessageQueue sl@0: // sl@0: sl@0: inline CBaServBackupMessageQueue::TQueueItem::TQueueItem(HBufC* aFileName,TInt aOperation) sl@0: : iFileName(aFileName), iOperation(aOperation) sl@0: {} sl@0: sl@0: CBaServBackupMessageQueue* CBaServBackupMessageQueue::NewL() sl@0: { // static sl@0: CBaServBackupMessageQueue* self=new(ELeave) CBaServBackupMessageQueue(); sl@0: return self; sl@0: } sl@0: sl@0: CBaServBackupMessageQueue::~CBaServBackupMessageQueue() sl@0: { sl@0: const TInt count=iQueue.Count(); sl@0: for (TInt ii=0;ii=0;ii--) sl@0: { sl@0: const TQueueItem& item=iQueue[ii]; sl@0: if (aFileName.MatchF(*item.iFileName) == KErrNone) sl@0: { sl@0: delete item.iFileName; sl@0: iQueue.Remove(ii); sl@0: iQueue.Compress(); sl@0: } sl@0: } sl@0: } sl@0: sl@0: void CBaServBackupMessageQueue::GetHead(TDes& aFileName,MBackupObserver::TFileLockFlags& aFlag) const sl@0: { sl@0: aFileName.Zero(); sl@0: const TInt index=HeadIndex(); sl@0: if (index!=KErrNotFound) sl@0: { sl@0: const TQueueItem& item=iQueue[index]; sl@0: aFileName=item.iFileName->Des(); sl@0: aFlag=(MBackupObserver::TFileLockFlags)item.iOperation; sl@0: } sl@0: } sl@0: sl@0: TInt CBaServBackupMessageQueue::HeadIndex() const sl@0: { sl@0: TInt index=KErrNotFound; sl@0: const TInt count=iQueue.Count(); sl@0: for (TInt ii=0;iiConstructL(); sl@0: CleanupStack::Pop(); // self sl@0: return self; sl@0: } sl@0: sl@0: /** sl@0: * sl@0: * Constructor. sl@0: * sl@0: * @param "RThread aClient" sl@0: * The client thread for which this server-side client session is being constructed. sl@0: */ sl@0: EXPORT_C CBaServBackupSession::CBaServBackupSession() sl@0: : CSession2() sl@0: { sl@0: iUniqueClientId = (TUint32)this; sl@0: } sl@0: sl@0: /** sl@0: * sl@0: * Destructor. sl@0: * sl@0: */ sl@0: EXPORT_C CBaServBackupSession::~CBaServBackupSession() sl@0: { sl@0: CBaBackupServer* server=BackupServer(); sl@0: if (server->IsClientBusy(iUniqueClientId)) sl@0: { sl@0: RestartAll(); sl@0: if (server->IsBackupOperationRunning()) sl@0: { sl@0: TBackupOperationAttributes backupOpAtt(MBackupObserver::ETakeLock, MBackupOperationObserver::EAbort); sl@0: server->SignalBackupOperation(backupOpAtt); sl@0: server->SetBackupOperationRunning(EFalse); sl@0: } sl@0: server->SetBusy(0); sl@0: } sl@0: sl@0: if (iFileLockObservers) sl@0: { sl@0: server->DecrementRegisteredFilesCount(iFileLockObservers->Count()); sl@0: } sl@0: sl@0: delete iClosedFiles; sl@0: delete iFileLockObservers; sl@0: delete iReleasedFiles; sl@0: delete iMessageQueue; sl@0: delete iReRegistrationTimer; sl@0: iReRegistrationTimer = 0; sl@0: server->DropSession(); sl@0: } sl@0: sl@0: /** sl@0: * sl@0: * Completes the session construction by creating a CBaServBackupMessageQueue object. sl@0: * sl@0: */ sl@0: EXPORT_C void CBaServBackupSession::ConstructL() sl@0: { sl@0: iMessageQueue=CBaServBackupMessageQueue::NewL(); sl@0: sl@0: // Cannot set iBackupServer in CReRegistrationTimer at this point but must be done before call to Start sl@0: iReRegistrationTimer=CBaServBackupSession::CReRegistrationTimer::NewL(CActive::EPriorityStandard); sl@0: } sl@0: sl@0: /** sl@0: * sl@0: * Completes the construction of this CBaServBackupSession session by just doing a base call class. sl@0: * It also notify the server that a new session has been created. sl@0: * sl@0: * @param "const CServer& aServer" sl@0: * The server active object which is responsible for this session sl@0: */ sl@0: EXPORT_C void CBaServBackupSession::CreateL() sl@0: { sl@0: BackupServer()->AddSession(); sl@0: } sl@0: sl@0: void CBaServBackupSession::SignalReleaseAllFileLocksL(MBackupObserver::TFileLockFlags aFlag) sl@0: { sl@0: CBaBackupServer* server=BackupServer(); sl@0: if (iFileLockObservers) sl@0: { sl@0: const TInt count=iFileLockObservers->Count(); sl@0: for (TInt ii=0;iiCloseFileL(aFlag,name); sl@0: } sl@0: } sl@0: } sl@0: sl@0: void CBaServBackupSession::SignalRetakeAllFileLocks() sl@0: { sl@0: // CBaBackupServer* server=BackupServer(); sl@0: if (iReleasedFiles) sl@0: { sl@0: const TInt count=iReleasedFiles->Count(); sl@0: for (TInt ii=count-1;ii>=0;ii--) sl@0: { sl@0: TFileName name=(*iReleasedFiles)[ii]; sl@0: // server->RestartFile(name); sl@0: SignalRetakeFileLocks(name); sl@0: } sl@0: } sl@0: } sl@0: sl@0: LOCAL_C void CleanupCloseFail(TAny* aPtr) sl@0: { sl@0: CDesCArray* array=REINTERPRET_CAST(CDesCArray*,aPtr); sl@0: array->Delete(array->Count()-1); sl@0: } sl@0: sl@0: void CBaServBackupSession::SignalReleaseFileLockL(MBackupObserver::TFileLockFlags aFlag,const TDesC& aFileName) sl@0: { sl@0: TInt pos; sl@0: if (iFileLockObservers && iFileLockObservers->Find(aFileName,pos)==KErrNone) sl@0: { sl@0: if (iReleasedFiles==NULL) sl@0: { sl@0: iReleasedFiles=new(ELeave) CDesCArraySeg(1); sl@0: } sl@0: const TBool addedReleasedFile=iReleasedFiles->Find(aFileName,pos)!=KErrNone; sl@0: if (addedReleasedFile) sl@0: { sl@0: iReleasedFiles->AppendL(aFileName); sl@0: CleanupStack::PushL(TCleanupItem(CleanupCloseFail,iReleasedFiles)); sl@0: } sl@0: iMessageQueue->AddItemL(aFileName,aFlag); sl@0: if (!iNotificationPullMsg.IsNull()) sl@0: { sl@0: iNotificationPullMsg.Complete(KErrNone); sl@0: sl@0: // Okay - if this is part of a CloseAll operation we need to kick off a ReRegistration timer sl@0: if (BackupServer()->IsCloseAllOperationRunning()) sl@0: { sl@0: // Set backup server for the timer sl@0: iReRegistrationTimer->iBackupServer = BackupServer(); sl@0: sl@0: // If hardware use patchable constant if not default to 3 seconds sl@0: iReRegistrationTimer->Start(KBaBackupFileLockReRegistrationTimeout, KBaBackupFileLockReRegistrationTimeout, TCallBack(CBaServBackupSession::CReRegistrationTimer::ReRegistrationTimerCallBack, iReRegistrationTimer)); sl@0: } sl@0: sl@0: } sl@0: if (addedReleasedFile) sl@0: { sl@0: CleanupStack::Pop(); // CleanupCloseFail sl@0: } sl@0: } sl@0: } sl@0: sl@0: void CBaServBackupSession::SignalRetakeFileLocks(const TDesC& aFileName) sl@0: { sl@0: if (iReleasedFiles) sl@0: { sl@0: const TInt count=iReleasedFiles->Count(); sl@0: for (TInt ii=count-1;ii>=0;ii--) sl@0: { sl@0: TFileName name=(*iReleasedFiles)[ii]; sl@0: if (name.MatchF(aFileName)==0) sl@0: { sl@0: iMessageQueue->AddItem(aFileName); sl@0: if (!iNotificationPullMsg.IsNull()) sl@0: { sl@0: iNotificationPullMsg.Complete(KErrNone); sl@0: } sl@0: iReleasedFiles->Delete(ii); sl@0: } sl@0: } sl@0: if (iReleasedFiles->Count()==0) sl@0: { sl@0: delete iReleasedFiles; sl@0: iReleasedFiles=NULL; sl@0: if (iClosedFiles==NULL && BackupServer()->IsClientBusy(iUniqueClientId)) sl@0: { sl@0: BackupServer()->SetBusy(0); sl@0: } sl@0: } sl@0: } sl@0: } sl@0: sl@0: /** sl@0: * sl@0: * Allows the session to handle the error. sl@0: * sl@0: * @param "TInt aError" sl@0: * The error. sl@0: */ sl@0: EXPORT_C void CBaServBackupSession::HandleError(TInt aError) sl@0: { sl@0: if (aError==KLeaveWithoutAlert) sl@0: { sl@0: CBaServBackupScheduler::Current()->SetErrorHandler(NULL); sl@0: } sl@0: } sl@0: sl@0: void CBaServBackupSession::DoServiceL(TCompletionType& aCompleteType) sl@0: { sl@0: switch (iClientMessage->Function()) sl@0: { sl@0: case EBakOpCodeEventReady: sl@0: { sl@0: HandleEventReadyL(); sl@0: aCompleteType = ECompleteAsync; sl@0: } sl@0: break; sl@0: case EBakOpCodeStopNotifications: sl@0: { sl@0: StopNotifications(); sl@0: } sl@0: break; sl@0: case EBakOpCodeGetEvent: sl@0: GetEventL(); sl@0: break; sl@0: case EBakOpCodeCloseAllFiles: sl@0: { sl@0: aCompleteType = CloseAllFilesL(iClientMessage->Message()); sl@0: } sl@0: break; sl@0: case EBakOpCodeRestartAll: sl@0: RestartAll(); sl@0: break; sl@0: case EBakOpCodeCloseFile: sl@0: CloseFileL(); sl@0: break; sl@0: case EBakOpCodeRestartFile: sl@0: RestartFileL(); sl@0: break; sl@0: case EBakOpCodeNotifyLockChange: sl@0: NotifyLockChangeL(); sl@0: break; sl@0: case EBakOpCodeNotifyLockChangeCancel: sl@0: NotifyLockChangeCancelL(); sl@0: break; sl@0: case EBakOpCodeNotifyBackupOperation: sl@0: NotifyBackupOperationL(); sl@0: break; sl@0: case EBakOpCodeCancelOutstandingBackupOperationEvent: sl@0: { sl@0: iBackupOperationObserverPresent = EFalse; sl@0: if (!iBackupOperationMessagePtr.IsNull()) sl@0: { sl@0: GetBackupOperationEventL(iBackupOperationMessagePtr); sl@0: iBackupOperationMessagePtr.Complete(KErrCancel); sl@0: } sl@0: } sl@0: break; sl@0: case EBakOpCodeGetBackupOperationState: sl@0: GetBackupOperationStateL(); sl@0: break; sl@0: case EBakOpCodeBackupOperationEventReady: sl@0: BackupOperationEventReadyL(); sl@0: aCompleteType = ECompleteAsync; sl@0: break; sl@0: case EBakOpCodeGetBackupOperationEvent: sl@0: GetBackupOperationEventL(iClientMessage->Message()); sl@0: break; sl@0: case EBakOpCodeSetBackupOperationObserverIsPresent: sl@0: { sl@0: iBackupOperationObserverPresent = iClientMessage->GetIntL(0); sl@0: } sl@0: break; sl@0: default: sl@0: User::Leave(KErrNotSupported); sl@0: break; sl@0: } sl@0: } sl@0: sl@0: sl@0: /** sl@0: * sl@0: * Handles the servicing of client requests passed to the backup server. sl@0: * sl@0: * @param "const RMessage& aMessage" sl@0: * The message containing the client request. sl@0: */ sl@0: EXPORT_C void CBaServBackupSession::ServiceL(const RMessage2& aMessage) sl@0: { sl@0: sl@0: TCompletionType completionType = ECompleteSync; sl@0: sl@0: BSUL::CClientMessage* clientMessage = 0; sl@0: clientMessage = BSUL::CClientMessage::NewL(aMessage); sl@0: sl@0: //Push iClientMessage onto the cleanupstack. Although an instance variable, sl@0: //the lifetime of the object is contained to this function so it needs to sl@0: //be pushed and popped here as it is not deleted in the destructor sl@0: CleanupStack::PushL(clientMessage); sl@0: sl@0: //Validate the message sl@0: TRAPD(error, clientMessage->ValidateL()); sl@0: sl@0: iClientMessage = clientMessage; sl@0: sl@0: if(error == KErrNone) sl@0: { sl@0: TRAP(error, DoServiceL(completionType)); sl@0: } sl@0: sl@0: if(completionType == ECompleteSync) sl@0: { sl@0: if (error==KLeaveWithoutAlert) sl@0: { sl@0: CBaServBackupScheduler::Current()->SetErrorHandler(NULL); sl@0: } sl@0: else sl@0: { sl@0: iClientMessage->CompleteRequestL(error); sl@0: } sl@0: } sl@0: sl@0: //Pop and destroy message sl@0: CleanupStack::PopAndDestroy(clientMessage); sl@0: clientMessage = NULL; sl@0: iClientMessage = NULL; sl@0: } sl@0: sl@0: void CBaServBackupSession::HandleEventReadyL() sl@0: { sl@0: if (iReRegistrationTimer->IsActive()) sl@0: { // If timer is still active (ie not timed out) we need to increment the counter and cancel the timer sl@0: BackupServer()->IncrementFilesReRegistrationCount(); sl@0: iReRegistrationTimer->Cancel(); sl@0: } sl@0: // else timer is already inactive because it's expired sl@0: sl@0: if (iMessageQueue->IsEmpty()) sl@0: { sl@0: iNotificationPullMsg = iClientMessage->Message(); sl@0: } sl@0: else sl@0: { sl@0: iClientMessage->CompleteRequestL(KErrNone); sl@0: } sl@0: } sl@0: sl@0: const TInt KEventFileNameOffset=1; sl@0: sl@0: void CBaServBackupSession::GetEventL() sl@0: { sl@0: TFileName fileName; sl@0: MBackupObserver::TFileLockFlags fileFlag; sl@0: if(!iMessageQueue->IsEmpty()) sl@0: { sl@0: iMessageQueue->GetHead(fileName,fileFlag); sl@0: TBuf num; sl@0: num.Num((TInt)fileFlag); sl@0: sl@0: iClientMessage->WriteL(0,num,0); sl@0: sl@0: iClientMessage->WriteL(0,fileName,KEventFileNameOffset); sl@0: sl@0: iMessageQueue->RemoveHead(); sl@0: } sl@0: else sl@0: { sl@0: iClientMessage->PanicClient(KPanic,ENoEventToFetch); sl@0: User::Leave(KLeaveWithoutAlert); sl@0: } sl@0: } sl@0: sl@0: void CBaServBackupSession::CleanupCloseAllFiles(TAny* aPtr) sl@0: { // static sl@0: CBaServBackupSession* self=REINTERPRET_CAST(CBaServBackupSession*,aPtr); sl@0: delete self->iClosedFiles; sl@0: self->iClosedFiles=NULL; sl@0: self->BackupServer()->RestartAll(); sl@0: } sl@0: sl@0: /** sl@0: Asks the server to close all files. This function may leave in case the server is busy. sl@0: If the requesting client is the current busy client and it has already requested CloseAll, sl@0: this request will be ignored. sl@0: sl@0: @param aMessage The reference to the message containing the client request: file lock. sl@0: @leave KErrServerBusy if the requesting client is not the busy client. Plus other system-wide sl@0: errors. sl@0: */ sl@0: EXPORT_C TCompletionType CBaServBackupSession::CloseAllFilesL(const RMessage2& aMessage) sl@0: { sl@0: // Raise file lock notifications sl@0: TRAPD(err,DoCloseAllFilesL(aMessage)); sl@0: sl@0: if (err == KErrNone) sl@0: { sl@0: // Start timer to check all file locks re-registered before completing message sl@0: BackupServer()->StartCloseAllFilesOperationTimer(aMessage); sl@0: } sl@0: else sl@0: { sl@0: // If the error is that the same client has already requested CloseAll, ignore this request sl@0: // If not this error, recover the CloseAllOperationRunningState flag and leave with the error. sl@0: if (err != KErrAlreadyExists) sl@0: { sl@0: BackupServer()->SetCloseAllOperationRunningState(EFalse); sl@0: User::Leave(err); sl@0: } sl@0: } sl@0: sl@0: return ECompleteAsync; sl@0: } sl@0: sl@0: void CBaBackupServer::IncrementRegisteredFilesCount() sl@0: { sl@0: iRegisteredFilesCount++; sl@0: } sl@0: sl@0: void CBaBackupServer::DecrementRegisteredFilesCount(TInt aNumberFiles) sl@0: { sl@0: iRegisteredFilesCount = iRegisteredFilesCount - aNumberFiles; sl@0: } sl@0: sl@0: void CBaBackupServer::IncrementFilesReRegistrationCount() sl@0: { sl@0: iSessionLockReRegistrationCount++; sl@0: } sl@0: sl@0: /** sl@0: Function called by both base and derived backup sessions in order to start asynchronous sl@0: file lock notifications. sl@0: The requesting client is set to the current busy client. sl@0: sl@0: @leave KErrServerBusy if the requesting client is not the current busy client or the server sl@0: is under CloseAll operation. KErrAlreadyExists if the same client has sent CloseAll request. sl@0: Plus other system-wide errors. sl@0: */ sl@0: sl@0: EXPORT_C TCompletionType CBaServBackupSession::DoCloseAllFilesL(const RMessage2& /*aMessage*/) sl@0: { sl@0: CBaBackupServer* server=BackupServer(); sl@0: if (server->IsOtherClientBusy(iUniqueClientId)) sl@0: { sl@0: User::Leave(KErrServerBusy); sl@0: } sl@0: sl@0: if (BackupServer()->IsCloseAllOperationRunning()) sl@0: { sl@0: User::Leave(KErrAlreadyExists); sl@0: } sl@0: sl@0: CleanupStack::PushL(TCleanupItem(CleanupCloseAllFiles,this)); sl@0: if (iClosedFiles) sl@0: { sl@0: delete iClosedFiles; sl@0: iClosedFiles=NULL; sl@0: } sl@0: server->SetBusy(iUniqueClientId); sl@0: sl@0: MBackupObserver::TFileLockFlags fileFlag= sl@0: (MBackupObserver::TFileLockFlags)iClientMessage->GetIntL(0); sl@0: server->CloseAllFilesL(fileFlag); sl@0: sl@0: iClosedFiles=new(ELeave) CArrayFixSeg(1); sl@0: CBaServBackupScheduler::Current()->SetErrorHandler(this); sl@0: CleanupStack::Pop(); // CleanupCloseAllFiles sl@0: return ECompleteAsync; sl@0: } sl@0: sl@0: /** sl@0: * sl@0: * Asks the server to signal all clients of getting the lock of their respective files. sl@0: * sl@0: */ sl@0: EXPORT_C void CBaServBackupSession::RestartAll() sl@0: { sl@0: CBaBackupServer* server=BackupServer(); sl@0: if (server->IsClientBusy(iUniqueClientId)) sl@0: { sl@0: DoRestartAll(); sl@0: } sl@0: } sl@0: sl@0: void CBaServBackupSession::DoRestartAll() sl@0: { sl@0: CBaBackupServer* server=BackupServer(); sl@0: server->RestartAll(); sl@0: delete iReleasedFiles; sl@0: iReleasedFiles=NULL; sl@0: if (iClosedFiles) sl@0: { sl@0: CArrayFix* closedFiles=iClosedFiles; sl@0: iClosedFiles=NULL; sl@0: server->CompleteClosingFiles(closedFiles); // takes ownership of closedFiles immediately sl@0: } sl@0: } sl@0: sl@0: /** sl@0: Handle the client's request to close a file. sl@0: The request will be ignored if the requesting client the current busy client and the server is sl@0: under CloseAll operation. sl@0: sl@0: @leave KErrServerBusy if the server is busy with the other client, plus other system-wide errors. sl@0: */ sl@0: void CBaServBackupSession::CloseFileL() sl@0: { sl@0: CBaBackupServer* server=BackupServer(); sl@0: if (server->IsOtherClientBusy(iUniqueClientId)) sl@0: { sl@0: User::Leave(KErrServerBusy); sl@0: } sl@0: sl@0: if (! server->IsCloseAllOperationRunning()) sl@0: { sl@0: MBackupObserver::TFileLockFlags flag= sl@0: static_cast(iClientMessage->GetIntL(2)); sl@0: TFileName fileName; sl@0: GetFileNameL(fileName); sl@0: server->SetBusy(iUniqueClientId); sl@0: server->CloseFileL(flag,fileName); sl@0: } sl@0: } sl@0: sl@0: void CBaServBackupSession::RestartFileL() sl@0: { sl@0: TFileName fileName; sl@0: GetFileNameL(fileName); sl@0: BackupServer()->RestartFile(fileName); sl@0: } sl@0: sl@0: /** sl@0: Handles the client's request of notification of a file lock change. sl@0: sl@0: @leave KErrServerBusy if the server is under CloseAll operation, KLeaveWithoutAlert if the requested sl@0: file has been registered. Plus other system-wide errors. sl@0: */ sl@0: void CBaServBackupSession::NotifyLockChangeL() sl@0: { sl@0: if(BackupServer()->IsCloseAllOperationRunning()) sl@0: { sl@0: User::Leave(KErrServerBusy); sl@0: } sl@0: sl@0: TFileName fileName; sl@0: GetFileNameL(fileName); sl@0: if (iFileLockObservers==NULL) sl@0: { sl@0: iFileLockObservers=new(ELeave) CDesCArraySeg(1); sl@0: } sl@0: else sl@0: { sl@0: TInt pos; sl@0: if(iFileLockObservers->Find(fileName,pos)== KErrNone) sl@0: { sl@0: iClientMessage->PanicClient(KPanic,EReqAlreadyOutstanding); sl@0: User::Leave(KLeaveWithoutAlert); sl@0: } sl@0: } sl@0: iFileLockObservers->AppendL(fileName); sl@0: BackupServer()->IncrementRegisteredFilesCount(); sl@0: } sl@0: sl@0: LOCAL_C void RemoveFileName(CDesCArray& aArray,const TDesC& aFileName) sl@0: { sl@0: TInt pos; sl@0: if (aArray.Find(aFileName,pos)==KErrNone) sl@0: { sl@0: aArray.Delete(pos); sl@0: } sl@0: } sl@0: sl@0: void CBaServBackupSession::NotifyLockChangeCancelL() sl@0: { sl@0: TFileName fileName; sl@0: GetFileNameL(fileName); sl@0: if (iFileLockObservers) sl@0: { sl@0: RemoveFileName(*iFileLockObservers,fileName); sl@0: BackupServer()->DecrementRegisteredFilesCount(); sl@0: } sl@0: if (iReleasedFiles) sl@0: { sl@0: RemoveFileName(*iReleasedFiles,fileName); sl@0: } sl@0: iMessageQueue->RemoveItem(fileName); sl@0: } sl@0: sl@0: void CBaServBackupSession::GetFileNameL(TDes& aFileName) sl@0: { sl@0: //The verification of this parameter has already been handled sl@0: //by the CClientMessage class so we can safely read the value sl@0: iClientMessage->ReadL(1,aFileName); sl@0: } sl@0: sl@0: sl@0: void CBaServBackupSession::GetBackupOperationEventL(const RMessagePtr2& aPtr) sl@0: { sl@0: TPckg backupOpAttPkg(iBackupOperationAttributes); sl@0: sl@0: aPtr.WriteL(0, backupOpAttPkg); sl@0: } sl@0: sl@0: void CBaServBackupSession::BackupOperationEventReadyL() sl@0: { sl@0: if (iBackupOperationObserverPresent) sl@0: { sl@0: iBackupOperationMessagePtr = iClientMessage->Message(); sl@0: } sl@0: else sl@0: { sl@0: iClientMessage->CompleteRequestL(KErrNone); sl@0: } sl@0: } sl@0: sl@0: void CBaServBackupSession::NotifyBackupOperationL() sl@0: { sl@0: CBaBackupServer* server=BackupServer(); sl@0: if (server->CBaBackupServer::IsOtherClientBusy(iUniqueClientId)) sl@0: { sl@0: User::Leave(KErrServerBusy); sl@0: } sl@0: TPckg backupOpAttPkg(iBackupOperationAttributes); sl@0: sl@0: iClientMessage->ReadL(0,backupOpAttPkg); sl@0: sl@0: const TBool backupOperationRunning = ((iBackupOperationAttributes.iOperation==MBackupOperationObserver::EStart) ? ETrue : EFalse); sl@0: server->SetBackupOperationRunning(backupOperationRunning); sl@0: server->SetBusy(backupOperationRunning ? iUniqueClientId : 0); sl@0: server->SignalBackupOperation(iBackupOperationAttributes); sl@0: if (!iBackupOperationMessagePtr.IsNull()) sl@0: { sl@0: GetBackupOperationEventL(iBackupOperationMessagePtr); sl@0: iBackupOperationMessagePtr.Complete(KErrCancel); sl@0: } sl@0: } sl@0: sl@0: void CBaServBackupSession::GetBackupOperationStateL() sl@0: { sl@0: const TBool isRunning = BackupServer()->IsBackupOperationRunning(); sl@0: TPckgC pkgObs(isRunning); sl@0: sl@0: iClientMessage->WriteL(0, pkgObs); sl@0: } sl@0: sl@0: void CBaServBackupSession::SignalBackupOperation(const TBackupOperationAttributes& aBackupOperationAttributes) sl@0: { sl@0: iBackupOperationAttributes = aBackupOperationAttributes; sl@0: if (!iBackupOperationMessagePtr.IsNull()) sl@0: { sl@0: TRAPD(err,GetBackupOperationEventL(iBackupOperationMessagePtr)); sl@0: iBackupOperationMessagePtr.Complete(err); sl@0: } sl@0: } sl@0: sl@0: void CBaServBackupSession::StopNotifications() sl@0: { sl@0: if(!iNotificationPullMsg.IsNull()) sl@0: {// complete the registration message sl@0: iNotificationPullMsg.Complete(KErrNone); sl@0: } sl@0: } sl@0: sl@0: /** sl@0: @internalComponent sl@0: */ sl@0: CBaServBackupSession::CReRegistrationTimer* CBaServBackupSession::CReRegistrationTimer::NewL(TInt aPriority) sl@0: { // static sl@0: CBaServBackupSession::CReRegistrationTimer* self=new(ELeave) CBaServBackupSession::CReRegistrationTimer(aPriority); sl@0: CleanupStack::PushL(self); sl@0: self->ConstructL(); sl@0: CleanupStack::Pop(); // self sl@0: CActiveScheduler::Add(self); sl@0: return self; sl@0: } sl@0: sl@0: /** sl@0: @internalComponent sl@0: */ sl@0: TInt CBaServBackupSession::CReRegistrationTimer::RunError(TInt aError) sl@0: { sl@0: if (aError==KLeaveWithoutAlert) sl@0: { sl@0: return KErrNone; sl@0: } sl@0: return aError; sl@0: } sl@0: sl@0: /** sl@0: @internalComponent sl@0: */ sl@0: CBaServBackupSession::CReRegistrationTimer::CReRegistrationTimer(TInt aPriority) sl@0: : CPeriodic(aPriority) sl@0: { } sl@0: sl@0: /** sl@0: @internalComponent sl@0: */ sl@0: TInt CBaServBackupSession::CReRegistrationTimer::ReRegistrationTimerCallBack(TAny* aPtr) sl@0: { // static sl@0: TRAP_IGNORE(REINTERPRET_CAST(CBaServBackupSession::CReRegistrationTimer*,aPtr)->HandleReRegistrationTimerCallBack()); sl@0: return 0; sl@0: } sl@0: sl@0: /** sl@0: @internalComponent sl@0: */ sl@0: void CBaServBackupSession::CReRegistrationTimer::HandleReRegistrationTimerCallBack() sl@0: { sl@0: iBackupServer->IncrementFilesReRegistrationCount(); sl@0: sl@0: if (IsActive()) sl@0: { sl@0: Cancel(); sl@0: } sl@0: } sl@0: