webservices/wsconnection/src/senservicedispatcher.cpp
changeset 23 a1df79fa35b4
parent 0 62f9d29f7211
equal deleted inserted replaced
16:abb636afedf7 23:a1df79fa35b4
   154     
   154     
   155     TLSLOG_L(KSenDispatcherLogChannel, KSenDispatcherLogLevel, "CSenServiceDispatcher::ExecuteL - Resumed.");
   155     TLSLOG_L(KSenDispatcherLogChannel, KSenDispatcherLogLevel, "CSenServiceDispatcher::ExecuteL - Resumed.");
   156     
   156     
   157     for(;;)
   157     for(;;)
   158         {
   158         {
       
   159         TLSLOG_L(KSenDispatcherLogChannel, KSenDispatcherLogLevel, "CSenServiceDispatcher::ExecuteL Before User::WaitForAnyRequest()");
   159         User::WaitForAnyRequest();
   160         User::WaitForAnyRequest();
       
   161         TLSLOG_L(KSenDispatcherLogChannel, KSenDispatcherLogLevel, "CSenServiceDispatcher::ExecuteL After User::WaitForAnyRequest()");
   160 
   162 
   161         //If iDispatchMessages = FALSE then stop dispacthing messages.
   163         //If iDispatchMessages = FALSE then stop dispacthing messages.
   162         //Is called from the destructor and thread will end in cleaner way
   164         //Is called from the destructor and thread will end in cleaner way
   163         //by deleting the allocated objects on it's heap.
   165         //by deleting the allocated objects on it's heap.
   164         if(!aThis->iDispatchMessages)
   166         if(!aThis->iDispatchMessages)
   310         }  
   312         }  
   311     return appendRetVal;
   313     return appendRetVal;
   312     }
   314     }
   313 TBool CSenServiceDispatcher::RemoveFromQueue(TInt aTransactionID)
   315 TBool CSenServiceDispatcher::RemoveFromQueue(TInt aTransactionID)
   314     {
   316     {
       
   317     TLSLOG_FORMAT((KSenDispatcherLogChannel, KSenDispatcherLogLevel, _L("CSenServiceDispatcher::RemoveFromQueue - VrtlTxnID (%d)"), aTransactionID));
   315     //This method gets called from two places 1)main thread from
   318     //This method gets called from two places 1)main thread from
   316     //CancelTransaction(aTransactionID) method and 2)child thread from
   319     //CancelTransaction(aTransactionID) method and 2)child thread from
   317     //ExecuteL method once message has been dispacthed.
   320     //ExecuteL method once message has been dispacthed.
   318     TBool found = EFalse;
   321     TBool found = EFalse;
   319     iCsMessageQueue.Wait();
   322     iCsMessageQueue.Wait();
   366         return *ipTransactionsMap;
   369         return *ipTransactionsMap;
   367     }
   370     }
   368 
   371 
   369 TInt CSenServiceDispatcher::AddToTheTransMap(TInt* pVrtlaTxnId,TInt* pActlTxnId)
   372 TInt CSenServiceDispatcher::AddToTheTransMap(TInt* pVrtlaTxnId,TInt* pActlTxnId)
   370     {
   373     {
       
   374     TLSLOG_FORMAT((KSenDispatcherLogChannel, KSenDispatcherLogLevel, _L("CSenServiceDispatcher::AddToTheTransMap - VrtlTxnID [%d], ActlTxnId [%d]"), pVrtlaTxnId, pActlTxnId));
   371     TInt returnValue = KErrNone;
   375     TInt returnValue = KErrNone;
   372     //Wait on transaction map critical section if it is locked, and then add to 
   376     //Wait on transaction map critical section if it is locked, and then add to 
   373     //the map.
   377     //the map.
   374     //Critical section is required as RemoveFromTransMap(aTrasnactionID) is called
   378     //Critical section is required as RemoveFromTransMap(aTrasnactionID) is called
   375     //from main thread also. To avoid crash as ipTransactionsMap
   379     //from main thread also. To avoid crash as ipTransactionsMap
   380     return returnValue;
   384     return returnValue;
   381     }
   385     }
   382 
   386 
   383 TInt CSenServiceDispatcher::RemoveFromTransMap(TInt* pVrtlaTxnId)
   387 TInt CSenServiceDispatcher::RemoveFromTransMap(TInt* pVrtlaTxnId)
   384     {
   388     {
       
   389     TLSLOG_FORMAT((KSenDispatcherLogChannel, KSenDispatcherLogLevel, _L("CSenServiceDispatcher::RemoveFromTransMap - VrtlTxnID [%d]"), pVrtlaTxnId));
   385     TInt returnValue = KErrNone;
   390     TInt returnValue = KErrNone;
   386     //Is called from the main thread after we recieve the response.
   391     //Is called from the main thread after we recieve the response.
   387     returnValue = TransactionMap().Find(*pVrtlaTxnId);
   392     returnValue = TransactionMap().Find(*pVrtlaTxnId);
   388     if( returnValue != KErrNotFound )
   393     if( returnValue != KErrNotFound )
   389         {
   394         {
   394     return returnValue;
   399     return returnValue;
   395     }
   400     }
   396 
   401 
   397 TInt CSenServiceDispatcher::UpdateTransMap(TInt* pVrtlaTxnId,TInt* pActlTxnId)
   402 TInt CSenServiceDispatcher::UpdateTransMap(TInt* pVrtlaTxnId,TInt* pActlTxnId)
   398     {
   403     {
       
   404     TLSLOG_FORMAT((KSenDispatcherLogChannel, KSenDispatcherLogLevel, _L("CSenServiceDispatcher::UpdateTransMap - VrtlTxnID [%d], ActlTxnId [%d]"), pVrtlaTxnId, pActlTxnId));
   399     TInt returnValue = KErrNone;
   405     TInt returnValue = KErrNone;
   400     //Is called from the main thread from HandleMessageChildAOL method.
   406     //Is called from the main thread from HandleMessageChildAOL method.
   401     //Typically gets called when ESenReAuthAndResendNeeded and ESenResendNeeded
   407     //Typically gets called when ESenReAuthAndResendNeeded and ESenResendNeeded
   402     //is required.
   408     //is required.
   403     returnValue = TransactionMap().Find(*pVrtlaTxnId);
   409     returnValue = TransactionMap().Find(*pVrtlaTxnId);